Lint
This commit is contained in:
+15
-16
@@ -260,7 +260,7 @@ trait Compilable {
|
||||
self,
|
||||
state: &mut State,
|
||||
function: Option<&mut CompiledFn>,
|
||||
location: Location
|
||||
location: Location,
|
||||
) -> Result<(), CompileError>;
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ impl Compilable for RepeatLoop {
|
||||
fn process(self, state: &mut State, sig: Option<&mut CompiledFn>, loc: Location) -> Result<(), CompileError> {
|
||||
let sig = sig.expect("Repeat loop outside function");
|
||||
|
||||
if let RepeatLoop{ count, name, body } = self {
|
||||
let RepeatLoop { count, name, body } = self;
|
||||
let named_counter = name.is_some();
|
||||
let mut counter_name = String::new();
|
||||
if let Some(name) = name {
|
||||
@@ -431,7 +431,6 @@ impl Compilable for RepeatLoop {
|
||||
if named_counter {
|
||||
sig.forget_last_local();
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1052,7 +1051,7 @@ mod test {
|
||||
vec![
|
||||
("_forge_gensym_1".into(), "foo".into()),
|
||||
("_forge_gensym_3".into(), "bar".into()), // gensym 2 is the entrypoint of blah()
|
||||
("_forge_gensym_4".into(), "norp".into())
|
||||
("_forge_gensym_4".into(), "norp".into()),
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -1064,7 +1063,7 @@ mod test {
|
||||
"push _forge_gensym_4",
|
||||
"loadw frame",
|
||||
"add 3", // the address of y (frame + 3) and put gensym_4 in it
|
||||
"storew"
|
||||
"storew",
|
||||
]
|
||||
.join("\n")
|
||||
)
|
||||
@@ -1081,7 +1080,7 @@ mod test {
|
||||
"loadw frame", // The addr of x
|
||||
"loadw frame",
|
||||
"add 3", // the address of y (frame + 3) and put the addr of x (frame) in it
|
||||
"storew"
|
||||
"storew",
|
||||
]
|
||||
.join("\n")
|
||||
)
|
||||
@@ -1099,7 +1098,7 @@ mod test {
|
||||
"loadw",
|
||||
"loadw", // Then load the value at 3
|
||||
"push 1000", // Push the addr 1000, for the lvalue
|
||||
"storew" // Store whatever's at 3 to 1000
|
||||
"storew", // Store whatever's at 3 to 1000
|
||||
]
|
||||
.join("\n")
|
||||
)
|
||||
@@ -1114,7 +1113,7 @@ mod test {
|
||||
"push 3", // so 3 is the string "bar"
|
||||
"add", // Add 3 to that address
|
||||
"loadw frame", // Store it in the first var
|
||||
"storew"
|
||||
"storew",
|
||||
]
|
||||
.join("\n")
|
||||
)
|
||||
@@ -1127,7 +1126,7 @@ mod test {
|
||||
vec![
|
||||
"loadw frame", // Push the addr of x
|
||||
"swap 12", // The asm body, which swaps 12 behind it and stores it there
|
||||
"storew"
|
||||
"storew",
|
||||
]
|
||||
.join("\n")
|
||||
)
|
||||
@@ -1211,7 +1210,7 @@ mod test {
|
||||
"loadw frame",
|
||||
"add 3",
|
||||
"storew", // c = c + 1
|
||||
"#end" // End the loop body
|
||||
"#end", // End the loop body
|
||||
]
|
||||
.join("\n")
|
||||
);
|
||||
@@ -1252,7 +1251,7 @@ mod test {
|
||||
"call", // Actually make the call
|
||||
"popr", // Restore the frame ptr
|
||||
"storew frame",
|
||||
"pop" // expr-as-statement drops the evaluated value
|
||||
"pop", // expr-as-statement drops the evaluated value
|
||||
]
|
||||
.join("\n")
|
||||
);
|
||||
@@ -1339,7 +1338,7 @@ mod test {
|
||||
"loadw frame", // Load x so we can return it
|
||||
"add 3",
|
||||
"loadw",
|
||||
"ret"
|
||||
"ret",
|
||||
]
|
||||
.join("\n")
|
||||
);
|
||||
@@ -1374,7 +1373,7 @@ mod test {
|
||||
"loadw frame", // Load x so we can return it
|
||||
"add 3",
|
||||
"loadw",
|
||||
"ret"
|
||||
"ret",
|
||||
].join("\n")
|
||||
);
|
||||
}
|
||||
@@ -1391,7 +1390,7 @@ mod test {
|
||||
"push 5",
|
||||
"ret",
|
||||
"frame: .db $+1",
|
||||
".db 0"
|
||||
".db 0",
|
||||
].join("\n"));
|
||||
|
||||
// Slightly more complicated, with a global str
|
||||
@@ -1405,7 +1404,7 @@ mod test {
|
||||
"push _forge_gensym_1",
|
||||
"ret",
|
||||
"frame: .db $+1",
|
||||
".db 0"
|
||||
".db 0",
|
||||
].join("\n"))
|
||||
}
|
||||
|
||||
@@ -1440,7 +1439,7 @@ mod test {
|
||||
"storew", // taking the same (now freed) frame slot that c took, because c is
|
||||
"loadw frame", // now out of scope
|
||||
"loadw",
|
||||
"ret"
|
||||
"ret",
|
||||
]
|
||||
.join("\n")
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user