From 003d22286cd0c7bf515d24825dd5bcaa1cead79a Mon Sep 17 00:00:00 2001 From: Jaime Humberto Macias Bustamante Date: Mon, 21 Jul 2025 16:47:01 -0700 Subject: [PATCH] super call fixes --- hscript/CustomClass.hx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hscript/CustomClass.hx b/hscript/CustomClass.hx index 64ea7eb..7c2f9a4 100644 --- a/hscript/CustomClass.hx +++ b/hscript/CustomClass.hx @@ -133,11 +133,11 @@ class CustomClass implements IHScriptCustomClassBehaviour { } public function call(name:String, ?args:Array, ?toSuper:Bool = false):Dynamic { - var fn:Dynamic = null; - if (!toSuper) + // TODO: optimize this + var fnName = toSuper ? '_HX_SUPER__$name' : name; + var fn:Dynamic = __interp.variables.get(fnName); + if(toSuper && fn == null) fn = __interp.variables.get(name); - else - fn = __interp.variables.get('_HX_SUPER__$name'); if (fn != null && Reflect.isFunction(fn)) return UnsafeReflect.callMethodUnsafe(null, fn, (args == null) ? [] : args);