fix: add location data for LOAD_FUNCs

This commit is contained in:
TopchetoEU 2024-11-24 12:48:49 +02:00
parent 39eb6ffac5
commit 5c2fd00bfb
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4
2 changed files with 3 additions and 3 deletions

View File

@ -19,8 +19,8 @@ public class FunctionStatementNode extends FunctionNode {
@Override public void compile(CompileResult target, boolean pollute, String name, BreakpointType bp) { @Override public void compile(CompileResult target, boolean pollute, String name, BreakpointType bp) {
var id = target.addChild(compileBody(target, name, null)); var id = target.addChild(compileBody(target, name, null));
target.add(Instruction.loadFunc(id, name, captures(id, target))); target.add(Instruction.loadFunc(id, name, captures(id, target))).setLocation(loc());;
target.add(VariableNode.toInit(target, end, this.name)); target.add(VariableNode.toSet(target, end, this.name, false, true));
if (pollute) target.add(Instruction.pushUndefined()); if (pollute) target.add(Instruction.pushUndefined());
} }

View File

@ -14,7 +14,7 @@ public class FunctionValueNode extends FunctionNode {
@Override public void compile(CompileResult target, boolean pollute, String name, BreakpointType bp) { @Override public void compile(CompileResult target, boolean pollute, String name, BreakpointType bp) {
var id = target.addChild(compileBody(target, name, name)); var id = target.addChild(compileBody(target, name, name));
target.add(Instruction.loadFunc(id, name, captures(id, target))); target.add(Instruction.loadFunc(id, name, captures(id, target))).setLocation(loc());
} }
public FunctionValueNode(Location loc, Location end, List<VariableNode> params, CompoundNode body, String name) { public FunctionValueNode(Location loc, Location end, List<VariableNode> params, CompoundNode body, String name) {