fix: parsing files won't modify last instruction to RET, instead will just append it

This commit is contained in:
TopchetoEU 2023-11-25 18:44:11 +02:00
parent f0ad936e5b
commit 86d205e521
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4

View File

@ -1896,10 +1896,7 @@ public class Parsing {
res.add(Instruction.throwSyntax(e)); res.add(Instruction.throwSyntax(e));
} }
if (res.size() != 0 && res.get(res.size() - 1).type == Type.DISCARD) { res.add(Instruction.ret());
res.set(res.size() - 1, Instruction.ret());
}
else res.add(Instruction.ret());
return new CodeFunction(environment, "", subscope.localsCount(), 0, new ValueVariable[0], new FunctionBody(res.array(), subscope.captures(), subscope.locals())); return new CodeFunction(environment, "", subscope.localsCount(), 0, new ValueVariable[0], new FunctionBody(res.array(), subscope.captures(), subscope.locals()));
} }