This snippet:
is compiled as:
Push 0, 0, "makeFunc"
CallFunction
CallFunction // <-- wrong
Pop
which isn't correct; CallFunction expects the name of the function to call, not the function itself, so the PCode should instead be:
Push 0, 0, "makeFunc"
CallFunction
Push undefined // or equivalently, Push ""
CallMethod
Pop
EDIT: A similar issue exists for new (makeClass())()
// Rascal PCode
Push 0, 0, "makeClass"
CallFunction
NewMethod // <-- wrong
// also, missing Pop?
// Expected PCode
Push 0, 0, "makeClass"
CallFunction
Push undefined // or equivalently, Push ""
NewMethod
Pop
This snippet:
is compiled as:
which isn't correct;
CallFunctionexpects the name of the function to call, not the function itself, so the PCode should instead be:EDIT: A similar issue exists for
new (makeClass())()