From 7f087eab039b8547742ea493ebac677b6e6f11b0 Mon Sep 17 00:00:00 2001 From: Jaime Humberto Macias Bustamante Date: Fri, 1 Aug 2025 16:55:13 -0700 Subject: [PATCH] fixed getting property fields on superclass Basically "Type.getInstanceFields" doesn't take into account property fields, so it uses "Reflect.fields" to fetch the rest of fields. --- hscript/CustomClass.hx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hscript/CustomClass.hx b/hscript/CustomClass.hx index 85872e7..f9caee0 100644 --- a/hscript/CustomClass.hx +++ b/hscript/CustomClass.hx @@ -124,8 +124,14 @@ class CustomClass implements IHScriptCustomClassBehaviour { if(__cachedFieldSet != null) UnsafeReflect.setField(__class.cl, "__cachedFieldSet", __cachedFieldSet); - var disallowCopy = Type.getInstanceFields(__class.cl); __superClass = Type.createInstance(__class.cl, args); + var disallowCopy:Array = { + var fieldMap:Map = []; // Prevent duplicate values + for(f in Reflect.fields(__superClass).concat(Type.getInstanceFields(Type.getClass(__superClass)))) + fieldMap.set(f, f); + + fieldMap.array(); + } this.__real_fields = disallowCopy; @:privateAccess __interp.__instanceFields = __interp.__instanceFields.concat(disallowCopy); __superClass.__real_fields = this.__real_fields;