簡體   English   中英

Haxe用參數生成超級調用

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM