Skip to content

Commit 1b86f43

Browse files
TechnikTilAbnormalPoof
authored andcommitted
Fix Scripted Class Extending not working with multiple layers of scripted classes
Signed-off-by: TechnikTil <techniktil@tilnotdrip.org>
1 parent f5ee5b6 commit 1b86f43

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

polymod/hscript/_internal/HScriptedClassMacro.hx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -995,18 +995,26 @@ class HScriptedClassMacro
995995
{_asc.callFunction($v{funcName}, [$a{func_callArgs}]); return;}) : (macro return _asc.callFunction($v{funcName}, [$a{func_callArgs}]))
996996
}
997997
}
998-
// If another scripted class is being extended, call if the function exists there
999-
else if ((_asc.superClass is polymod.hscript._internal.PolymodScriptClass)
1000-
&& _asc.superClass.hasScriptFunction($v{funcName}))
998+
else
1001999
{
1002-
var _super = (_asc.superClass : polymod.hscript._internal.PolymodScriptClass);
1003-
$
1000+
// If another scripted class is being extended, call if the function exists there
1001+
var _super = _asc.superClass;
1002+
while (_super is polymod.hscript._internal.PolymodScriptClass)
10041003
{
1005-
doesReturnVoid ? (macro
1004+
var _scriptSuper = (_super : polymod.hscript._internal.PolymodScriptClass);
1005+
if (_scriptSuper.hasScriptFunction($v{funcName}))
1006+
{
1007+
$
10061008
{
1007-
_super.callFunction($v{funcName}, [$a{func_callArgs}]);
1008-
return;
1009-
}) : (macro return _super.callFunction($v{funcName}, [$a{func_callArgs}]))
1009+
doesReturnVoid ? (macro
1010+
{
1011+
_scriptSuper.callFunction($v{funcName}, [$a{func_callArgs}]);
1012+
return;
1013+
}) : (macro return _scriptSuper.callFunction($v{funcName}, [$a{func_callArgs}]))
1014+
}
1015+
}
1016+
1017+
_super = _scriptSuper.superClass;
10101018
}
10111019
}
10121020
}

0 commit comments

Comments
 (0)