Created
June 24, 2013 07:49
-
-
Save jasononeil/5848408 to your computer and use it in GitHub Desktop.
Minimal reproducible test for this error message: /usr/lib/haxe/std/sys/db/Object.hx:29: characters 2-11 : You cannot use @:build inside a macro : make sure that your enum is not used in 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.Expr; | |
import haxe.macro.Context; | |
import neko.Lib; | |
class BuildInMacroTests { | |
public static function main() { | |
var s:MyModel = new MyModel(); | |
Formatter.__Output_Formatter( s ); | |
} | |
} | |
class MyModel extends sys.db.Object | |
{ | |
var id:Int; | |
var name:String; | |
} | |
private class Formatter { | |
public static macro function __Output_Formatter(output : Expr) : Expr { | |
return output; | |
} | |
} |
You can also wrap "MyModel" and "BuildInMacroTests" in #if !macro ... #end
conditionals which also resolves the issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moving "Formatter" do a different .hx file / module solves the issue.