[英]Haxe generating super call with arguments
上下文是類型構建宏。 我的目標是產生
super(arg1, arg2, arg3)
我有的:
Array<FunctionArg> => [{ meta => null, name => foo, type => TPath({ name => StdTypes, pack => [], params => [], sub => Int }), opt => null, value => null },{ meta => null, name => bar, type => TPath({ name => StdTypes, pack => [], params => [], sub => Int }), opt => null, value => null }]
我已經嘗試了macro super($a{ancestorArgs})
但是這很愚蠢,因為$a
期望Array<Expr>
。
我沒有想法了。
嘗試:
var args = [ for ( arg in funcArgs ) macro $i { arg.name } ];
func.expr = macro
{
super( $a{ args } );
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.