haxe
haxe copied to clipboard
[js] Dce removes static field with function call
class Main {
static final numbers = [];
static function addNum(n:Int):Int {
numbers.push(n);
return n;
}
static final node = addNum(1);
static function main() {
trace(numbers.length); // 0
}
}
Fine on eval.
Hmm, I vaguely remember that this is by design, but looking at it now makes me question if that design is any good...
As mentioned in #10766, I think ideally purity would be taken into account here.