From 86d205e521e347115e23409fb9bea56b4f66338e Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sat, 25 Nov 2023 18:44:11 +0200 Subject: [PATCH] fix: parsing files won't modify last instruction to RET, instead will just append it --- src/me/topchetoeu/jscript/parsing/Parsing.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/me/topchetoeu/jscript/parsing/Parsing.java b/src/me/topchetoeu/jscript/parsing/Parsing.java index d96aa34..fd598c8 100644 --- a/src/me/topchetoeu/jscript/parsing/Parsing.java +++ b/src/me/topchetoeu/jscript/parsing/Parsing.java @@ -1896,10 +1896,7 @@ public class Parsing { res.add(Instruction.throwSyntax(e)); } - if (res.size() != 0 && res.get(res.size() - 1).type == Type.DISCARD) { - res.set(res.size() - 1, Instruction.ret()); - } - else res.add(Instruction.ret()); + res.add(Instruction.ret()); return new CodeFunction(environment, "", subscope.localsCount(), 0, new ValueVariable[0], new FunctionBody(res.array(), subscope.captures(), subscope.locals())); }