HaxeFoundation/haxe — pull request #3085 by Simn (2014-05-31 09:01:16+00:00)
Title: add -D unreflective and @:reflective

This pull request adds the -D unreflective flag which tells the CPP generator to not generate `__Field` and `__SetField` bodies by default. Individual classes and fields can be marked with `@:reflective` to keep the reflection information.

We also try to detect cases where we "probably" need the reflection information, i.e. when a TInst is assigned to TDynamic or TAnon. For the unit tests this wasn't quite enough and I had to add `@:reflective` in a few places:

* unit.Test: This is obvious, we want to keep all the test fields to call them via reflection.
* unit.PropertyAccessorsFromBaseClass: This is used only via Type.resolveClass, which makes it impossible to detect.
* Type: This one bugs me a bit. I think it comes from the Unserializer using it as a resolver, but I have to investigate this a bit more.

My main concern is that this is not so easy to debug. Maybe we can let gencpp output some print if a `__Field` call is made which has no field information.