Created
January 23, 2013 02:33
-
-
Save sonygod/4601345 to your computer and use it in GitHub Desktop.
test tink_bell creat class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ; | |
import haxe.macro.Expr; | |
import haxe.macro.Context; | |
import test.test.Testx; | |
import tink.lang.Cls; | |
using tink.macro.tools.MacroTools; | |
class Main implements Cls { | |
static function main() { | |
var l2 = new List<GenericEnum>(); | |
l2.add(eFoo2(new Foo2())); | |
l2.add(eBar(new Bar())); | |
for (i in l2) { | |
switch(i) { | |
case eFoo2(f): { trace(f.name + "" + f.baz()); } | |
case eBar(b): { trace(b.name); } | |
} | |
} | |
testMacro(); | |
} | |
@:macro static function testMacro():Expr { | |
return "test.test.Testx".instantiate(["hello".toExpr()]); | |
} | |
} | |
enum GenericEnum { | |
eFoo2(f:Foo2); | |
eBar(b:Bar); | |
} | |
typedef GenericType = { name:String} | |
// some class | |
class Foo2 { | |
public function new() { name = 'Foo2 Object'; } | |
public var name:String; | |
public function baz():String { return 'baz!'; } | |
} | |
// some other class, for simplicity's sake, they have nothing to do with eachother (no extend, implement) | |
class Bar { | |
public function new() { name = 'Bar Object'; } | |
public var name:String; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment