src/jdk/nashorn/internal/codegen/CodeGenerator.java
Print this page
*** 683,693 ****
}
private void scopeCall(final IdentNode node, final int flags) {
load(node, Type.OBJECT); // Type.OBJECT as foo() makes no sense if foo == 3
// ScriptFunction will see CALLSITE_SCOPE and will bind scope accordingly.
! method.loadNull(); //the 'this'
method.dynamicCall(callNodeType, 2 + loadArgs(args), flags);
}
private void evalCall(final IdentNode node, final int flags) {
load(node, Type.OBJECT); // Type.OBJECT as foo() makes no sense if foo == 3
--- 683,693 ----
}
private void scopeCall(final IdentNode node, final int flags) {
load(node, Type.OBJECT); // Type.OBJECT as foo() makes no sense if foo == 3
// ScriptFunction will see CALLSITE_SCOPE and will bind scope accordingly.
! method.loadUndefined(Type.OBJECT); //the 'this' object
method.dynamicCall(callNodeType, 2 + loadArgs(args), flags);
}
private void evalCall(final IdentNode node, final int flags) {
load(node, Type.OBJECT); // Type.OBJECT as foo() makes no sense if foo == 3
*** 816,826 ****
@Override
protected boolean enterDefault(final Node node) {
// Load up function.
load(function, Type.OBJECT); //TODO, e.g. booleans can be used as functions
! method.loadNull(); // ScriptFunction will figure out the correct this when it sees CALLSITE_SCOPE
method.dynamicCall(callNodeType, 2 + loadArgs(args), getCallSiteFlags() | CALLSITE_SCOPE);
return false;
}
});
--- 816,826 ----
@Override
protected boolean enterDefault(final Node node) {
// Load up function.
load(function, Type.OBJECT); //TODO, e.g. booleans can be used as functions
! method.loadUndefined(Type.OBJECT); // ScriptFunction will figure out the correct this when it sees CALLSITE_SCOPE
method.dynamicCall(callNodeType, 2 + loadArgs(args), getCallSiteFlags() | CALLSITE_SCOPE);
return false;
}
});