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
Convert js-style callback to Future, with macro |
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
import haxe.macro.Context; | |
import haxe.macro.Expr; | |
class Builder { | |
// Build macros are called using @:build() or @:autoBuild() metadata | |
// They must return an array containing all of the fields of the new type | |
macro static function build():Array<Field> { | |
// Create expression representing the test() function | |
var funcExpr = macro function():String { | |
return "test"; |