@@ -179,8 +179,6 @@ class PolymodScriptClassMacro {
179179 for (field in abstractImplType .statics .get ()) {
180180 switch (field .kind ) {
181181 case FVar (read , write ):
182- trace (field .name , read , write );
183-
184182 var canGet : Bool = read == AccInline || read == AccNormal ;
185183 if (read == AccCall ) {
186184 var getter : Null <ClassField > = null ;
@@ -239,9 +237,20 @@ class PolymodScriptClassMacro {
239237 pos : Context .currentPos (),
240238 name : fieldName ,
241239 access : [Access . APublic , Access . AStatic ],
242- kind : FProp (canGet ? ' get' : ' never' , canSet ? ' set' : ' never' , Context . toComplexType ( field . type ), null )
240+ kind : FProp (canGet ? ' get' : ' never' , canSet ? ' set' : ' never' , ( macro : Dynamic ), null )
243241 });
244242
243+ var fieldExpr : Expr = null ;
244+ try {
245+ // when this fails, this should mean that we are dealing with an enum abstract
246+ // so we need to handle it differently
247+ var fullPath : String = ' ${abstractType .module }. ${abstractType .name }' ;
248+ Context .getType (fullPath );
249+ fieldExpr = Context .parse (' ${fullPath }. ${field .name }' , Context .currentPos ());
250+ } catch (_ ) {
251+ fieldExpr = Context .getTypedExpr (field .expr ());
252+ }
253+
245254 if (canGet ) {
246255 fields .push ({
247256 pos : Context .currentPos (),
@@ -252,7 +261,7 @@ class PolymodScriptClassMacro {
252261 ret : null ,
253262 expr : macro {
254263 @:privateAccess
255- return ${Context . parse ( abstractPath + ' . ' + field . name , Context . currentPos ()) };
264+ return ${fieldExpr };
256265 }
257266 })
258267 });
@@ -268,7 +277,7 @@ class PolymodScriptClassMacro {
268277 ret : null ,
269278 expr : macro {
270279 @:privateAccess
271- return ${Context . parse ( abstractPath + ' . ' + field . name , Context . currentPos ()) } = value ;
280+ return ${fieldExpr } = value ;
272281 }
273282 })
274283 });
0 commit comments