Compare commits

..
Author SHA1 Message Date
gabry 75a21abecd revert accidental deletion of blocklist 2026-07-20 19:49:11 +02:00
gabry 763999c376 fix this binding loss on js 2026-07-20 19:10:23 +02:00
Jaime Humberto Macias Bustamante c1b23320c3 fixed set call with nullable values 2026-07-18 21:48:23 -07:00
Jaime Humberto Macias Bustamante 266bb67c93 moved import blacklist to Config.hx 2026-07-08 22:11:51 -07:00
Jaime Humberto Macias Bustamante 6276ddfc2c Update ClassExtendMacro.hx
i need a break...
2026-06-22 21:17:50 -07:00
Jaime Humberto Macias Bustamante b8ead38556 Squashed commit of the following:
commit 24abfa436e
Author: Jaime Humberto Macias Bustamante <jamextreme140@outlook.com>
Date:   Sat Jun 20 23:29:32 2026 -0700

    Update CustomClassHandler.hx

    forgot to change this too...

commit 92e458876e
Author: Jaime Humberto Macias Bustamante <jamextreme140@outlook.com>
Date:   Sat Jun 20 23:23:10 2026 -0700

    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.

commit 44d8b1e0e1
Author: Jaime Humberto Macias Bustamante <jamextreme140@outlook.com>
Date:   Sat Jun 20 19:39:17 2026 -0700

    better static field filtering

commit ff649efadf
Author: Jaime Humberto Macias Bustamante <jamextreme140@outlook.com>
Date:   Sat Jun 20 18:50:03 2026 -0700

    better accessor bypass handling

commit 4625529be7
Author: Crimson-is-stupid <89041944+Crimson-is-stupid@users.noreply.github.com>
Date:   Thu Jun 4 09:32:25 2026 +0300

    Reimplement Trigraph Fix (#18)

    * replace all "??=" with "??" + "="

    * Update Expr.hx

commit b9da833bb5
Author: Jaime Humberto Macias Bustamante <jamextreme140@outlook.com>
Date:   Wed Jun 3 17:14:08 2026 -0700

    better callAccessor + optimize "__allowGetSet"

commit 0c08f64274
Author: Jaime Humberto Macias Bustamante <jamextreme140@outlook.com>
Date:   Wed Jun 3 16:57:58 2026 -0700

    Update Property.hx

commit 3add08e0ee
Author: Jaime Humberto Macias Bustamante <jamextreme140@outlook.com>
Date:   Fri May 29 10:23:56 2026 -0700

    some docs + small optimizations

commit 77fae88890
Author: Jaime Humberto Macias Bustamante <jamextreme140@outlook.com>
Date:   Thu Apr 30 11:32:13 2026 -0700

    oversight again...

commit 2a301ea591
Author: Jaime Humberto Macias Bustamante <jamextreme140@outlook.com>
Date:   Thu Apr 30 11:27:07 2026 -0700

    fixed small oversight

commit 634d819cc2
Author: Jaime Humberto Macias Bustamante <jamextreme140@outlook.com>
Date:   Thu Apr 30 11:02:47 2026 -0700

    Refactor property fields

    Now you can call directly the getter/setter functions without triggering them again.
2026-06-20 23:46:55 -07:00
Crimson-is-stupidandGitHub 1972ae6a82 Reimplement Trigraph Fix (#18)
* replace all "??=" with "??" + "="

* Update Expr.hx
2026-06-03 23:32:25 -07:00
4 changed files with 28 additions and 22 deletions
+5
View File
@@ -21,4 +21,9 @@ class Config {
public static final DISALLOW_ABSTRACT_AND_ENUM = [ public static final DISALLOW_ABSTRACT_AND_ENUM = [
]; ];
@:unreflective
public static final IMPORT_BLACKLIST:Array<String> = [
// "flixel.FlxG"
];
} }
+16 -16
View File
@@ -166,10 +166,10 @@ class Interp {
public var allowStaticVariables:Bool = false; public var allowStaticVariables:Bool = false;
public var allowPublicVariables:Bool = false; public var allowPublicVariables:Bool = false;
// TODO: move this to an external class public var importBlocklist(get, never):Array<String>;
public var importBlocklist:Array<String> = [ private inline function get_importBlocklist():Array<String> {
// "flixel.FlxG" return Config.IMPORT_BLACKLIST;
]; }
var usingHandler:UsingHandler; var usingHandler:UsingHandler;
@@ -643,7 +643,7 @@ class Interp {
case VPublic: getProperty(publicVariables.get(id), id, allowProperty); case VPublic: getProperty(publicVariables.get(id), id, allowProperty);
case VStatic: getProperty(staticVariables.get(id), id, allowProperty); case VStatic: getProperty(staticVariables.get(id), id, allowProperty);
case VScriptObject: isBypassAccessor ? UnsafeReflect.field(scriptObject, id) : UnsafeReflect.getProperty(scriptObject, id); case VScriptObject: isBypassAccessor ? UnsafeReflect.field(scriptObject, id) : UnsafeReflect.getProperty(scriptObject, id);
case VScriptObjectGetter: UnsafeReflect.getProperty(scriptObject, 'get_$id')(); case VScriptObjectGetter: UnsafeReflect.callFieldUnsafe(scriptObject, 'get_$id', []);
case VCustomClass: (cast scriptObject:IHScriptCustomAccessBehaviour).hget(id); case VCustomClass: (cast scriptObject:IHScriptCustomAccessBehaviour).hget(id);
case VCustomClassBypass: case VCustomClassBypass:
var obj:IHScriptCustomAccessBehaviour = cast scriptObject; var obj:IHScriptCustomAccessBehaviour = cast scriptObject;
@@ -721,9 +721,10 @@ class Interp {
varLocationCache.set(id, VScriptObject); varLocationCache.set(id, VScriptObject);
return UnsafeReflect.getProperty(scriptObject, id); return UnsafeReflect.getProperty(scriptObject, id);
} }
} else if (__instanceFields.contains('get_$id')) { // getter } else if (__instanceFields.contains('get_$id')) { // getter
return UnsafeReflect.getProperty(scriptObject, 'get_$id')(); varLocationCache.set(id, VScriptObjectGetter);
} return UnsafeReflect.callFieldUnsafe(scriptObject, 'get_$id', []);
}
} }
varLocationCache.set(id, VNotFound); varLocationCache.set(id, VNotFound);
@@ -817,7 +818,6 @@ class Interp {
function importResolve(__clsName:String):Null<Dynamic> { function importResolve(__clsName:String):Null<Dynamic> {
var _realClassName = getLocalImportRedirect(__clsName); var _realClassName = getLocalImportRedirect(__clsName);
if(importBlocklist.contains(_realClassName)) return null;
var _cl = Type.resolveClass(_realClassName); var _cl = Type.resolveClass(_realClassName);
if(_cl == null) _cl = Type.resolveClass('${_realClassName}_HSC'); if(_cl == null) _cl = Type.resolveClass('${_realClassName}_HSC');
@@ -1134,7 +1134,7 @@ class Interp {
} }
return fcall(obj, f, args); return fcall(obj, f, args);
default: default:
return call(null, expr(e), args); return call(hasScriptObject ? scriptObject : null, expr(e), args);
} }
case EIf(econd, e1, e2): case EIf(econd, e1, e2):
return if (expr(econd) == true) expr(e1) else if (e2 == null) null else expr(e2); return if (expr(econd) == true) expr(e1) else if (e2 == null) null else expr(e2);
@@ -1403,12 +1403,12 @@ class Interp {
for (i => p in params) { for (i => p in params) {
switch (Tools.expr(p)) { switch (Tools.expr(p)) {
case EIdent(n): case EIdent(n):
declared.push({ declared.push({
n: n, n: n,
old: {r: locals.get(n), depth: depth}, old: {r: locals.get(n), depth: depth},
depth: depth depth: depth
}); });
locals.set(n, {r: valParams[i], depth: depth}); locals.set(n, {r: valParams[i], depth: depth});
default: default:
} }
} }
+2 -3
View File
@@ -135,7 +135,7 @@ class Property {
var fName:String = setterFunc; var fName:String = setterFunc;
if (!__allowWriteAccess && __allowSetGet) { if (!__allowWriteAccess && __allowSetGet) {
if (varExists(fName)) if (varExists(fName))
return callAccessor(fName, val); return callAccessor(fName, true, val);
else else
interp.error(ECustom('Method $fName required by property $name is missing')); interp.error(ECustom('Method $fName required by property $name is missing'));
} else { } else {
@@ -153,10 +153,9 @@ class Property {
return r = val; return r = val;
} }
private function callAccessor(f:String, ?value:Dynamic):Dynamic { private function callAccessor(f:String, isWrite:Bool = false, ?value:Dynamic):Dynamic {
var fn = isStatic ? interp.staticVariables.get(f) : interp.variables.get(f); var fn = isStatic ? interp.staticVariables.get(f) : interp.variables.get(f);
var rt:Dynamic = null; var rt:Dynamic = null;
var isWrite:Bool = value != null;
if (fn != null && Reflect.isFunction(fn)) { if (fn != null && Reflect.isFunction(fn)) {
if (isWrite) __allowWriteAccess = true; if (isWrite) __allowWriteAccess = true;
else __allowReadAccess = true; else __allowReadAccess = true;
+4 -2
View File
@@ -483,8 +483,9 @@ class ClassExtendMacro {
if (__interp != null) { if (__interp != null) {
if(__class__fields.contains(name)) { if(__class__fields.contains(name)) {
var v:Dynamic = __interp.variables.get(name); var v:Dynamic = __interp.variables.get(name);
var ba:Bool = @:privateAccess __interp.isBypassAccessor;
if(v != null && v is hscript.Property) if(v != null && v is hscript.Property)
return cast(v, hscript.Property).callGetter(name); return cast(v, hscript.Property).get(ba);
return v; return v;
} }
else @:privateAccess { else @:privateAccess {
@@ -536,8 +537,9 @@ class ClassExtendMacro {
if (__interp != null) { if (__interp != null) {
if(__class__fields.contains(name)) { if(__class__fields.contains(name)) {
var v:Dynamic = __interp.variables.get(name); var v:Dynamic = __interp.variables.get(name);
var ba:Bool = @:privateAccess __interp.isBypassAccessor;
if(v != null && v is hscript.Property) 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); __interp.variables.set(name, val);
return val; return val;
} }