Also fix the jump if its the last one
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
ff308649b9
commit
ae379df9db
7 changed files with 185 additions and 2 deletions
|
|
@ -147,7 +147,7 @@ fn emit_ast_expr(
|
|||
*jump = new_jump as isize;
|
||||
} else {
|
||||
panic!("Got an else without a previous if?");
|
||||
};
|
||||
}
|
||||
|
||||
if let Some(expression) = expression {
|
||||
let emit_slot = machine.reserve_slot();
|
||||
|
|
@ -167,6 +167,15 @@ fn emit_ast_expr(
|
|||
}
|
||||
}
|
||||
|
||||
if let Some(previous_jump) = previous_jump.take() {
|
||||
let new_jump = eval.len() - previous_jump - 1;
|
||||
let Instruction::JumpIfNotTrue { jump, .. } = &mut eval[previous_jump] else {
|
||||
panic!("Jump slot had something that is not a jump?!");
|
||||
};
|
||||
|
||||
*jump = new_jump as isize;
|
||||
}
|
||||
|
||||
if let Some(ws) = previous_post_whitespace_content {
|
||||
eval.push(Instruction::AppendContent {
|
||||
content: ws.source().clone(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue