diff --git a/hscript/Interp.hx b/hscript/Interp.hx index e6627be..6acf788 100644 --- a/hscript/Interp.hx +++ b/hscript/Interp.hx @@ -620,7 +620,7 @@ class Interp { } inline function getProperty(o:Null, n:String, allowProperty:Bool = true):Dynamic { - if(o != null && allowProperty && o is Property) + if(allowProperty && o != null && o is Property) return cast(o, Property).callGetter(n); else return o; @@ -644,12 +644,12 @@ class Interp { } } - for(map in [variables, publicVariables, staticVariables]) { - if(map.exists(id)) { - var r:Null = map.get(id); - return getProperty(r, id, allowProperty); - } - } + if (variables.exists(id)) + return getProperty(variables.get(id), id, allowProperty); + if (publicVariables.exists(id)) + return getProperty(publicVariables.get(id), id, allowProperty); + if (staticVariables.exists(id)) + return getProperty(staticVariables.get(id), id, allowProperty); if(customClasses.exists(id)) return customClasses.get(id);