Macro build error, geneated fields dont appear to be generated

83 views
Skip to first unread message

Porfírio Ribeiro

unread,
Apr 20, 2014, 7:57:29 AM4/20/14
to haxe...@googlegroups.com
Hi, something weird is happening with my macros.

I have a interface with a autoBuild macro.

That macro adds and removes fields from the class.

I can't find what i changed but i start getting this error:
You cannot use @:build inside a macro : make sure that your enum is not used in macro

So i searched on internet and found this post by Jason: http://jasono.co/2013/06/25/you-cannot-use-build-inside-a-macro-make-sure-that-your-enum-is-not-used-in-macro/

I have wrapped the autoBuild:
#if !macro @:autoBuild(g4.macro.ClassBuilder.process()) #end

But now i can't access any of the builded fields!
In fact i can access them using untyped, and generated functions can access it to but i can't access to them:

trace(this.p_x); //test.Main has no field p_x
trace(untyped this.p_x);//works, and the generated code works.

And all this worked before.

I don't know what could be wrong, can anyone give me a clue of what can be giving this problem?

Porfírio Ribeiro

unread,
Apr 21, 2014, 5:29:52 PM4/21/14
to haxe...@googlegroups.com
Hi.

After allot of dig i found the problem! Somehow FlashDevelop generated a import to a Class using a Interface with @:autoBuild in a Util class running at macro time...
 
Thank's anyway :p

Jason O'Neil

unread,
Apr 21, 2014, 6:27:18 PM4/21/14
to haxe...@googlegroups.com
Glad you found it, it's quite difficult to debug these errors :(

I've generally made a point to do a "git commit" fairly often so if a bug like this appears I can use "git diff" to see all the changes in code since the last working state, and usually it is an import like this.


--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Porfírio Ribeiro

unread,
Apr 22, 2014, 4:58:41 PM4/22/14
to haxe...@googlegroups.com, he...@jasono.co
Yeah, i should use git more exhaustive :p
But most times i am so deep in coding that i forgot that i should commit hehe.
Reply all
Reply to author
Forward
0 new messages