add jump for else statement
This commit is contained in:
@@ -38,11 +38,11 @@ size_t translate_parsed_if(Translated *translated, DArray *parsedIf) {
|
||||
} else {
|
||||
translate_parsed(translated, condition->content);
|
||||
push_instruction_byte(translated, OP_POP_SCOPE);
|
||||
jump_after_body_positions[i] = 0;
|
||||
push_instruction_byte(translated, OP_JUMP);
|
||||
jump_after_body_positions[i] = push_instruction_code(translated, 0);
|
||||
}
|
||||
}
|
||||
for (uint64_t i = 0; i < parsedIf->size; i++) {
|
||||
if (jump_after_body_positions[i])
|
||||
set_instruction_code(translated, jump_after_body_positions[i],
|
||||
translated->bytecode.size);
|
||||
}
|
||||
|
||||
5
test.ar
5
test.ar
@@ -59,7 +59,8 @@ let a,
|
||||
sum = a,
|
||||
another,
|
||||
another_function(),
|
||||
just_null_here
|
||||
just_null_here,
|
||||
x
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +78,7 @@ else term.log("bruh")
|
||||
|
||||
mm=x/2/4/2/4354/534/534//534//3422*404203420234+3432423324&&430234230||4320423040230423^384239423043024923%4432042304920.3432423423
|
||||
|
||||
let x = [
|
||||
let X = [
|
||||
'hello world',
|
||||
'wow',
|
||||
10
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# SPDX-FileCopyrightText: 2025 William Bell
|
||||
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
let y = 1
|
||||
let term = y
|
||||
|
||||
let x = do
|
||||
y
|
||||
return term
|
||||
do
|
||||
return y
|
||||
x
|
||||
return y
|
||||
Reference in New Issue
Block a user