diff --git a/hscript/CustomClass.hx b/hscript/CustomClass.hx index bf0cb91..3e88614 100644 --- a/hscript/CustomClass.hx +++ b/hscript/CustomClass.hx @@ -175,7 +175,7 @@ class CustomClass implements IHScriptCustomClassBehaviour { if (f != null && allowProperty && f is Property) { var prop:Property = cast f; prop.__allowSetGet = this.__allowSetGet; - var r = prop.callGetter(name); + var r = prop.callGetter(); prop.__allowSetGet = null; return r; } @@ -187,7 +187,7 @@ class CustomClass implements IHScriptCustomClassBehaviour { if (f != null && f is Property) { var prop:Property = cast f; prop.__allowSetGet = this.__allowSetGet; - var r = prop.callSetter(name, val); + var r = prop.callSetter(val); prop.__allowSetGet = null; return r; } diff --git a/hscript/CustomClassHandler.hx b/hscript/CustomClassHandler.hx index b200545..eef13f7 100644 --- a/hscript/CustomClassHandler.hx +++ b/hscript/CustomClassHandler.hx @@ -97,7 +97,7 @@ class CustomClassHandler implements IHScriptCustomConstructor implements IHScrip if(f is Property && allowProperty) { var prop:Property = cast f; prop.__allowSetGet = this.__allowSetGet; - var r = prop.callGetter(name); + var r = prop.callGetter(); prop.__allowSetGet = null; return r; } @@ -109,7 +109,7 @@ class CustomClassHandler implements IHScriptCustomConstructor implements IHScrip if(f is Property) { var prop:Property = cast f; prop.__allowSetGet = this.__allowSetGet; - var r = prop.callSetter(name, val); + var r = prop.callSetter(val); prop.__allowSetGet = null; return r; } diff --git a/hscript/Property.hx b/hscript/Property.hx index 641d665..4261749 100644 --- a/hscript/Property.hx +++ b/hscript/Property.hx @@ -97,8 +97,11 @@ class Property { } else interp.error(ECustom('Method $fName required by property $name is missing')); } else { - if ((setter == ADefault || setter == ANull) || isVar) + if ((setter == ADefault || setter == ANull) || isVar) { + if(!__callingProperty) + __allowReadAccess = false; return r; + } else interp.error(ECustom('Field $name cannot be accessed because it is not a real variable${interp.isBypassAccessor ? '. Add @:isVar to enable it' : ''}')); } @@ -122,8 +125,11 @@ class Property { else interp.error(ECustom('Method $fName required by property $name is missing')); } else { - if ((getter == ADefault || getter == ANull) || isVar) + if ((getter == ADefault || getter == ANull) || isVar) { + if(!__callingProperty) + __allowWriteAccess = false; return r = val; + } else interp.error(ECustom('Field $name cannot be accessed because it is not a real variable${interp.isBypassAccessor ? '. Add @:isVar to enable it' : ''}')); }