@@ -155,16 +155,16 @@ class PolymodStaticAbstractReference
155155 public var absImpl : Null <Class <Dynamic >>;
156156
157157 /**
158- * The path of the implementation class.
159- * Used for resolving static fields cached at macro time .
158+ * The class, generated by Polymod, that implements the abstract class's static fields as well as inline instance functions,
159+ * if it exists .
160160 */
161- public var absImplPath : String ;
161+ public var polymodImpl : Null < Class < Dynamic >> ;
162162
163- public function new (absName : String , absImpl : Null <Class <Dynamic >>, absImplPath : String )
163+ public function new (absName : String , absImpl : Null <Class <Dynamic >>, polymodImpl : Null < Class < Dynamic >> )
164164 {
165165 this .absName = absName ;
166166 this .absImpl = absImpl ;
167- this .absImplPath = absImplPath ;
167+ this .polymodImpl = polymodImpl ;
168168 }
169169
170170 /**
@@ -211,7 +211,17 @@ class PolymodStaticAbstractReference
211211 }
212212 }
213213
214- return fetchAbstractClassStatic (fieldName );
214+ if (this .polymodImpl != null )
215+ {
216+ var getterName : String = ' get_ $fieldName ' ;
217+ if (Reflect .hasField (this .polymodImpl , getterName ))
218+ {
219+ var getter = Reflect .field (this .polymodImpl , getterName );
220+ return Reflect .callMethod (this .polymodImpl , getter , []);
221+ }
222+ }
223+
224+ throw ' Could not resolve abstract class static field ${fieldName }' ;
215225 }
216226
217227 /**
@@ -259,21 +269,28 @@ class PolymodStaticAbstractReference
259269 throw ' Could not resolve abstract class static function ${funcName }' ;
260270 }
261271
262- function fetchAbstractClassStatic ( fieldName : String ): Dynamic
272+ public function hasInlineFunction ( funcName : String ): Bool
263273 {
264- var key : String = ' ${this .absImplPath }. ${fieldName }' ;
265-
266- if (PolymodScriptClass .abstractClassStatics .exists (key ))
274+ if (this .polymodImpl != null )
267275 {
268- var holder = PolymodScriptClass .abstractClassStatics .get (key );
269- var property = key .replace (' .' , ' _' );
270-
271- return Reflect .getProperty (holder , property );
276+ return Reflect .hasField (this .polymodImpl , funcName );
272277 }
273- else
278+
279+ return false ;
280+ }
281+
282+ public function callInlineFunction (interp : PolymodInterpEx , absInstanceExpr : Expr , funcName : String , args : Array <Dynamic >): Dynamic
283+ {
284+ if (this .polymodImpl != null )
274285 {
275- throw ' Could not resolve abstract class static field ${fieldName }' ;
286+ var func = Reflect .field (this .polymodImpl , funcName );
287+ if (func != null )
288+ {
289+ return Reflect .callMethod (this .polymodImpl , func , ([interp , absInstanceExpr ] : Array <Dynamic >).concat (args ));
290+ }
276291 }
292+
293+ throw ' Could not resolve abstract class inline instance function ${funcName }' ;
277294 }
278295
279296 public function toString (): String
0 commit comments