Found another one. 馃槄
Running function expression through haxe.macro.ExprTools.map makes analyzer remove the local static variable.
function main() {
new Foo().bar();
}
@:build(Macro.build())
class Foo {
public function new() {}
public function bar() {
static var last = 0;
if (last == 0) trace('A'); else trace('B');
last = 1 - last;
}
}
Module Macro.hx:
class Macro {
public static function build() {
var fields = haxe.macro.Context.getBuildFields();
function identity(e) return haxe.macro.ExprTools.map(e, identity);
for (f in fields) switch f.kind {
case FFun(f): f.expr = identity(f.expr);
case _:
};
return fields;
}
}
Found another one. 馃槄
Running function expression through
haxe.macro.ExprTools.mapmakes analyzer remove the local static variable.Module Macro.hx: