From ded0dccabedb549bac6bbad0395e2bcbe8d40d73 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Sun, 1 Sep 2024 17:44:20 +0300 Subject: [PATCH] oops --- .../jscript/compilation/FunctionNode.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/java/me/topchetoeu/jscript/compilation/FunctionNode.java b/src/java/me/topchetoeu/jscript/compilation/FunctionNode.java index 2b05291..daca4a5 100644 --- a/src/java/me/topchetoeu/jscript/compilation/FunctionNode.java +++ b/src/java/me/topchetoeu/jscript/compilation/FunctionNode.java @@ -47,10 +47,18 @@ public abstract class FunctionNode extends Node { } } - var funcScope = new FunctionScope(storeSelf ? name : null, args, target.scope); - var subtarget = new CompileResult(target.env, new LocalScope(funcScope)); + var env = target.env.child() + .remove(LabelContext.BREAK_CTX) + .remove(LabelContext.CONTINUE_CTX); - // compileStoreSelf(subtarget, pollute, bp); + var funcScope = new FunctionScope(target.scope); + var subtarget = new CompileResult(env, new LocalScope(funcScope)); + + for (var arg : args) { + // TODO: Implement default values + // TODO: Implement argument location + funcScope.defineArg(arg, loc()); + } body.resolve(subtarget); body.compile(subtarget, false);