Compare commits

..
Author SHA1 Message Date
Jaime Humberto Macias Bustamante 24abfa436e Update CustomClassHandler.hx
forgot to change this too...
2026-06-20 23:29:32 -07:00
Jaime Humberto Macias Bustamante 92e458876e remove direct function call handling
after testing, it turns out that trying to handle the direct getter/setter function will be so complex than I thought.
2026-06-20 23:23:10 -07:00
Jaime Humberto Macias Bustamante 44d8b1e0e1 better static field filtering 2026-06-20 19:39:17 -07:00
Jaime Humberto Macias Bustamante ff649efadf better accessor bypass handling 2026-06-20 18:50:03 -07:00
Crimson-is-stupidandJaime Humberto Macias Bustamante 4625529be7 Reimplement Trigraph Fix (#18)
* replace all "??=" with "??" + "="

* Update Expr.hx
2026-06-03 23:37:56 -07:00
Jaime Humberto Macias Bustamante b9da833bb5 better callAccessor + optimize "__allowGetSet" 2026-06-03 17:14:08 -07:00
Jaime Humberto Macias Bustamante 0c08f64274 Update Property.hx 2026-06-03 16:57:58 -07:00
Jaime Humberto Macias Bustamante 3add08e0ee some docs + small optimizations 2026-05-29 10:23:56 -07:00
Jaime Humberto Macias Bustamante 77fae88890 oversight again... 2026-04-30 11:32:13 -07:00
Jaime Humberto Macias Bustamante 2a301ea591 fixed small oversight 2026-04-30 11:27:07 -07:00
Jaime Humberto Macias Bustamante 634d819cc2 Refactor property fields
Now you can call directly the getter/setter functions without triggering them again.
2026-04-30 11:02:47 -07:00
4 changed files with 22 additions and 28 deletions
-5
View File
@@ -21,9 +21,4 @@ class Config {
public static final DISALLOW_ABSTRACT_AND_ENUM = [
];
@:unreflective
public static final IMPORT_BLACKLIST:Array<String> = [
// "flixel.FlxG"
];
}
+8 -8
View File
@@ -166,10 +166,10 @@ class Interp {
public var allowStaticVariables:Bool = false;
public var allowPublicVariables:Bool = false;
public var importBlocklist(get, never):Array<String>;
private inline function get_importBlocklist():Array<String> {
return Config.IMPORT_BLACKLIST;
}
// TODO: move this to an external class
public var importBlocklist:Array<String> = [
// "flixel.FlxG"
];
var usingHandler:UsingHandler;
@@ -643,7 +643,7 @@ class Interp {
case VPublic: getProperty(publicVariables.get(id), id, allowProperty);
case VStatic: getProperty(staticVariables.get(id), id, allowProperty);
case VScriptObject: isBypassAccessor ? UnsafeReflect.field(scriptObject, id) : UnsafeReflect.getProperty(scriptObject, id);
case VScriptObjectGetter: UnsafeReflect.callFieldUnsafe(scriptObject, 'get_$id', []);
case VScriptObjectGetter: UnsafeReflect.getProperty(scriptObject, 'get_$id')();
case VCustomClass: (cast scriptObject:IHScriptCustomAccessBehaviour).hget(id);
case VCustomClassBypass:
var obj:IHScriptCustomAccessBehaviour = cast scriptObject;
@@ -722,8 +722,7 @@ class Interp {
return UnsafeReflect.getProperty(scriptObject, id);
}
} else if (__instanceFields.contains('get_$id')) { // getter
varLocationCache.set(id, VScriptObjectGetter);
return UnsafeReflect.callFieldUnsafe(scriptObject, 'get_$id', []);
return UnsafeReflect.getProperty(scriptObject, 'get_$id')();
}
}
@@ -818,6 +817,7 @@ class Interp {
function importResolve(__clsName:String):Null<Dynamic> {
var _realClassName = getLocalImportRedirect(__clsName);
if(importBlocklist.contains(_realClassName)) return null;
var _cl = Type.resolveClass(_realClassName);
if(_cl == null) _cl = Type.resolveClass('${_realClassName}_HSC');
@@ -1134,7 +1134,7 @@ class Interp {
}
return fcall(obj, f, args);
default:
return call(hasScriptObject ? scriptObject : null, expr(e), args);
return call(null, expr(e), args);
}
case EIf(econd, e1, e2):
return if (expr(econd) == true) expr(e1) else if (e2 == null) null else expr(e2);
+3 -2
View File
@@ -135,7 +135,7 @@ class Property {
var fName:String = setterFunc;
if (!__allowWriteAccess && __allowSetGet) {
if (varExists(fName))
return callAccessor(fName, true, val);
return callAccessor(fName, val);
else
interp.error(ECustom('Method $fName required by property $name is missing'));
} else {
@@ -153,9 +153,10 @@ class Property {
return r = val;
}
private function callAccessor(f:String, isWrite:Bool = false, ?value:Dynamic):Dynamic {
private function callAccessor(f:String, ?value:Dynamic):Dynamic {
var fn = isStatic ? interp.staticVariables.get(f) : interp.variables.get(f);
var rt:Dynamic = null;
var isWrite:Bool = value != null;
if (fn != null && Reflect.isFunction(fn)) {
if (isWrite) __allowWriteAccess = true;
else __allowReadAccess = true;
+2 -4
View File
@@ -483,9 +483,8 @@ 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).get(ba);
return cast(v, hscript.Property).callGetter(name);
return v;
}
else @:privateAccess {
@@ -537,9 +536,8 @@ 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).set(val, ba);
return cast(v, hscript.Property).callSetter(name, val);
__interp.variables.set(name, val);
return val;
}