Created
January 12, 2012 07:52
-
-
Save back2dos/1599299 to your computer and use it in GitHub Desktop.
Building functions
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 ; | |
using tink.macro.tools.MacroTools; | |
import tink.macro.tools.AST; | |
import haxe.macro.Expr; | |
class Main { | |
static function main() { | |
var f = test1(); | |
trace(f()); | |
var f = test2(); | |
trace(f()); | |
var f = test3(); | |
trace(f()); | |
} | |
@:macro static function test1() { | |
return AST.build(function () { | |
return 7; | |
}); | |
} | |
@:macro static function test2() { | |
return 7.toExpr().func().toExpr(); | |
} | |
@:macro static function test3() { | |
return AST.build(function () { | |
var x = 7; | |
return x; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment