Skip to content

[BUG] Local functions persist in other class-level functions #322

@Starexify

Description

@Starexify

In polymod if we add a local function like:

override public function onCreate(event:ScriptEvent) {
  var value = 1;
  function myLocalFunction(i) {
    return value + i;
  }
  trace(myLocalFunction(2));
}

We could call it in a separate function in the class like so and it would work:

override public function onStateCreate(event:ScriptEvent):Void {
  trace(myLocalFunction(2));
}

And for some reason it would work.
Not sure if this should be allowed, but it seems like a bug to me since haxe doesn't allow this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions