diff --git a/hscript/CustomClass.hx b/hscript/CustomClass.hx index d3c5e32..5ed24e2 100644 --- a/hscript/CustomClass.hx +++ b/hscript/CustomClass.hx @@ -174,7 +174,6 @@ class CustomClass implements IHScriptCustomClassBehaviour { if (f != null && allowProperty && f is Property) { var prop:Property = cast f; //prop.__allowSetGet = this.__allowSetGet; - prop.__callingProperty = true; var r = prop.get(!__allowSetGet); //prop.__allowSetGet = true; return r; @@ -187,7 +186,6 @@ class CustomClass implements IHScriptCustomClassBehaviour { if (f != null && f is Property) { var prop:Property = cast f; //prop.__allowSetGet = this.__allowSetGet; - prop.__callingProperty = true; var r = prop.set(val, !__allowSetGet); //prop.__allowSetGet = true; return r; diff --git a/hscript/CustomClassHandler.hx b/hscript/CustomClassHandler.hx index 5e3c74f..177002c 100644 --- a/hscript/CustomClassHandler.hx +++ b/hscript/CustomClassHandler.hx @@ -93,7 +93,6 @@ class CustomClassHandler implements IHScriptCustomConstructor implements IHScrip if(f is Property && allowProperty) { var prop:Property = cast f; prop.__allowSetGet = this.__allowSetGet; - prop.__callingProperty = true; var r = prop.callGetter(); prop.__allowSetGet = true; return r; @@ -106,7 +105,6 @@ class CustomClassHandler implements IHScriptCustomConstructor implements IHScrip if(f is Property) { var prop:Property = cast f; prop.__allowSetGet = this.__allowSetGet; - prop.__callingProperty = true; var r = prop.callSetter(val); prop.__allowSetGet = true; return r; diff --git a/hscript/Interp.hx b/hscript/Interp.hx index 39318f2..6730ba0 100644 --- a/hscript/Interp.hx +++ b/hscript/Interp.hx @@ -301,7 +301,6 @@ class Interp { var obj = resolve(id, false, false); if (obj != null && obj is Property) { var prop:Property = cast obj; - prop.__callingProperty = true; return prop.set(v, isBypassAccessor); } varLocationCache.remove(id); @@ -309,7 +308,6 @@ class Interp { } } else if (l.r is Property) { var prop:Property = cast l.r; - prop.__callingProperty = true; return prop.set(v, isBypassAccessor); } else { l.r = v; @@ -384,7 +382,6 @@ class Interp { var obj = resolve(id, true, false); if (obj != null && obj is Property) { var prop:Property = cast obj; - prop.__callingProperty = true; return prop.set(v, isBypassAccessor); } varLocationCache.remove(id); @@ -395,7 +392,6 @@ class Interp { var l = locals.get(id); if (l.r is Property) { var prop:Property = cast l.r; - prop.__callingProperty = true; return prop.set(v, isBypassAccessor); } l.r = v; @@ -440,7 +436,6 @@ class Interp { var prop:Property = null; if (v is Property) { prop = cast v; - prop.__callingProperty = true; v = prop.get(isBypassAccessor); } @@ -463,7 +458,6 @@ class Interp { var prop:Property = null; if (v is Property) { prop = cast v; - prop.__callingProperty = true; v = prop.get(isBypassAccessor); } @@ -619,7 +613,6 @@ class Interp { inline function getProperty(o:Null, n:String, allowProperty:Bool = true):Dynamic { if(allowProperty && o != null && o is Property) { var prop:Property = cast o; - prop.__callingProperty = true; return prop.get(isBypassAccessor); } else diff --git a/hscript/Property.hx b/hscript/Property.hx index 3fcb50a..fcd1355 100644 --- a/hscript/Property.hx +++ b/hscript/Property.hx @@ -89,13 +89,6 @@ class Property { // Internal flag to gain access if the field is accessed with @:bypassAccessor var __allowSetGet:Bool = true; - /** - * Internal Flag to check if the get/set function hasn't been called directly. - */ - @:allow(hscript.Interp) - @:allow(hscript.CustomClass) - var __callingProperty:Bool = false; - final __isStatic:Bool = false; public function get(isBypassAccessor:Bool) { @@ -116,8 +109,6 @@ class Property { switch (getter) { case AGet | ADynamic: var fName:String = getterFunc; - if(!__callingProperty) - __allowReadAccess = true; if (!__allowReadAccess && __allowSetGet) { if (varExists(fName)) { return callAccessor(fName); @@ -125,8 +116,6 @@ class Property { interp.error(ECustom('Method $fName required by property $name is missing')); } else { if ((setter == ADefault || setter == ANull) || isVar) { - if(!__callingProperty) - __allowReadAccess = false; return r; } else @@ -144,8 +133,6 @@ class Property { switch (setter) { case ASet | ADynamic: var fName:String = setterFunc; - if(!__callingProperty) - __allowWriteAccess = true; if (!__allowWriteAccess && __allowSetGet) { if (varExists(fName)) return callAccessor(fName, val); @@ -153,8 +140,6 @@ class Property { interp.error(ECustom('Method $fName required by property $name is missing')); } else { if ((getter == ADefault || getter == ANull) || isVar) { - if(!__callingProperty) - __allowWriteAccess = false; return r = val; } else @@ -181,9 +166,6 @@ class Property { if (isWrite) __allowWriteAccess = false; else __allowReadAccess = false; - if(__callingProperty) - __callingProperty = false; - return rt; } else interp.error(ECustom('Method $f required by property ${f.substr(3)} is missing')); diff --git a/hscript/macros/ClassExtendMacro.hx b/hscript/macros/ClassExtendMacro.hx index e6f0eb3..9ddc05d 100644 --- a/hscript/macros/ClassExtendMacro.hx +++ b/hscript/macros/ClassExtendMacro.hx @@ -508,8 +508,9 @@ class ClassExtendMacro { if (__interp != null) { if(__class__fields.contains(name)) { var v:Dynamic = __interp.variables.get(name); + var ba:Bool = @:privateAccess __interp.isBypassAccessor; if(v != null && v is hscript.Property) - return cast(v, hscript.Property).callGetter(name); + return cast(v, hscript.Property).get(ba); return v; } else @:privateAccess { @@ -565,8 +566,9 @@ class ClassExtendMacro { if (__interp != null) { if(__class__fields.contains(name)) { var v:Dynamic = __interp.variables.get(name); + var ba:Bool = @:privateAccess __interp.isBypassAccessor; if(v != null && v is hscript.Property) - return cast(v, hscript.Property).callSetter(name, val); + return cast(v, hscript.Property).set(val, ba); __interp.variables.set(name, val); return val; }