DoclerLabs / hexMachina

Releases, issues, documentation, website of hexMachina, framework written in Haxe
http://hexmachina.org
MIT License
44 stars 8 forks source link

Allow later addition of fields with Inject metadata #173

Closed st3veV closed 7 years ago

st3veV commented 7 years ago

Currently if build macro creates a field (or anything else that can be used for dependency injection) with Inject metadata it's not properly reflected because the reflection is already done.

Possible solution - Expose API to rerun reflection at compile time on a type that has already been reflected and append new reflection data.

FrancisBourre commented 7 years ago

That's possible to regenerate class reflection by passing fields to FastAnnotationReader like shown below:

FastAnnotationReader.reflect( macro hex.di.IInjectorContainer, fields );
st3veV commented 7 years ago

FastAnnotationReader.reflect( macro hex.di.IInjectorContainer, fields ); Seems to have a bug because it's removing the previous reflected data so running this twice completely strips out everything that was reflected.