-
-
Notifications
You must be signed in to change notification settings - Fork 694
Closed
Description
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;
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels