HaxeFoundation / HaxeFoundation/haxe
Abstract inline set
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
Inlining an abstract function that modifies `this` is valid. This is used for example in haxe.EnumFlags.
However, this does not work when the variable is stored in a property. The setter will not be called, as the following example shows:
```haxe
abstract X(Int) {
public function new(v:Int) { this = v; }
public inline function incr() { this++; }
}
class Test {
static var B(default,set) : X;
static function main() {
var a = new X(3);
a.incr();
trace(a); // 4, ok !
B = new X(3);
B.incr(); // no set_4 !
}
static function set_B(v:X) {
trace("SET:"+v);
return v;
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.