Skip to content

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