Skip to content

Instantly share code, notes, and snippets.

@back2dos
Created January 12, 2012 07:52
Show Gist options
  • Save back2dos/1599299 to your computer and use it in GitHub Desktop.
Save back2dos/1599299 to your computer and use it in GitHub Desktop.
Building functions
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