haxe icon indicating copy to clipboard operation
haxe copied to clipboard

[js] Dce removes static field with function call

Open RblSb opened this issue 4 years ago • 2 comments

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.

RblSb avatar Oct 14 '21 09:10 RblSb

Hmm, I vaguely remember that this is by design, but looking at it now makes me question if that design is any good...

Simn avatar Oct 19 '21 12:10 Simn

As mentioned in #10766, I think ideally purity would be taken into account here.

back2dos avatar Jul 27 '22 11:07 back2dos