Skip to content
Snippets Groups Projects

Implement late-binding `static`, make `self` eager binding, closes #14

This changes self to a reference to the class it's in:

// input
class A {
  static $abc = 1;
  function xyz () { return self::$abc; }
}
// output
class A {
  static abc = 1;
  xyz() {
    return A.abc;
  }
};

And static to a late-bound reference:

// input
class A {
  static $abc = 1;
  static function lol () { return static::$abc; }
  function xyz () { return static::$abc; }
}
// output
class A {
  static abc = 1;
  static lol() {
    return this.abc;
  }
  xyz() {
    return this.constructor.abc;
  }
};

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading