I am porting a library from AS3 to Haxe and I need to make protected getters/setters. Target is a *.swc file.
My Haxe code looks like this:
private var foo(get, never):Int;
@:getter(foo)
private function get_foo():Int {
return 0;
}
private var bar:Int;
However the produced *.swc file is a little different:
native public function get foo():int;
native protected var bar:int;
Is there any known workaround?
It seems that @:getter
and -D swf-protected
(or @:protected
) don't play well together. Only one or the other is applied...
Example:
class Test {
var foo(get, never):Int;
@:protected @:getter(foo) private function get_foo():Int return 0;
var bar(get, never):Int;
@:getter(bar) @:protected private function get_bar():Int return 0;
}
generates:
protected function get get_foo() : int { return 0; }
public function get bar() : int { return 0; }
You should open an issue on the official repository.