Closed sonygod closed 11 years ago
You are mistaking type parameters for constructor arguments. It should be either of these:
ENew( { pack:["test","test"], name:"Testx", params:[] }, ["hello".toExpr()]).at();
"test.test.Testx".instantiate(["hello".toExpr()]);
macro new test.test.Testx("hello");
how about this
@:macro static function testFunction():Expr { var f = (function say(age:Int,name:String):String { return name+age; }) .toExpr(); return f.func(["age".toArg("Int".asComplexType()),"name".toArg("String".asComplexType())], "String".asComplexType()).toExpr(); }
and the generate code
function(age : int,name : String) : String { return null; }
what's wrong ?
import test.test.Testx;
using tink.macro.tools.MacroTools;
class Main { static function main() {
} /**
class Testx { public var a = 1; public function new(?target:String) { trace("hello--"+target); }
} **/ what's wrong with my caller?thanks.