Haxe 到 SWC - 受保护 getters/setters
Haxe to SWC - protected getters/setters
我正在将一个库从 AS3 移植到 Haxe,我需要进行保护 getters/setters。目标是 *.swc 文件。
我的 Haxe 代码如下所示:
private var foo(get, never):Int;
@:getter(foo)
private function get_foo():Int {
return 0;
}
private var bar:Int;
但是生成的 *.swc 文件有点不同:
native public function get foo():int;
native protected var bar:int;
是否有任何已知的解决方法?
您可以尝试添加 swf-protected global compiler flag
看来@:getter
和-D swf-protected
(或@:protected
)在一起玩得不太好。只应用其中之一...
示例:
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;
}
生成:
protected function get get_foo() : int { return 0; }
public function get bar() : int { return 0; }
你应该在 official repository 上打开一个问题。
我正在将一个库从 AS3 移植到 Haxe,我需要进行保护 getters/setters。目标是 *.swc 文件。
我的 Haxe 代码如下所示:
private var foo(get, never):Int;
@:getter(foo)
private function get_foo():Int {
return 0;
}
private var bar:Int;
但是生成的 *.swc 文件有点不同:
native public function get foo():int;
native protected var bar:int;
是否有任何已知的解决方法?
您可以尝试添加 swf-protected global compiler flag
看来@:getter
和-D swf-protected
(或@:protected
)在一起玩得不太好。只应用其中之一...
示例:
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;
}
生成:
protected function get get_foo() : int { return 0; }
public function get bar() : int { return 0; }
你应该在 official repository 上打开一个问题。