Skip to content

Miscompilation of makeFunc()() #71

Description

@moulins

This snippet:

makeFunc()();

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions