Skip to content

[BUG] Static Getters and Setters Just Don't Work When Being Set in the Same Class #341

@MightyTheArmiddilo

Description

@MightyTheArmiddilo

In Haxe, static getters and setters are a thing and are applied within the class. But for some reason polymod just doesn't do that. With Try Haxe it works as you'd expect, but not with polymod.

For example, if you try this in polymod:

import funkin.modding.module.Module;

class StaticTest {
  static var test(get, set):Int;

  static function get_test():Int {
    return 2;
  }

  static function set_test(value:Int):Int {
    trace('hello');
    return 2;
  }

  static function set(val) {
    trace(test);
    test = val;
    trace(test);
  }
}

class Test extends Module {
  public function new() {
    super('Test');
  }

  public function onCreate(event) {
    super.onCreate(event);

    StaticTest.set(5);
  }
}

You'd get

2
5

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