From d38b6003669a3d3e17206029b5d53d1f9d08880c Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Thu, 28 Mar 2024 14:52:49 +0200 Subject: [PATCH] fix: some more wrapper issues --- .../topchetoeu/jscript/runtime/values/NativeWrapper.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/java/me/topchetoeu/jscript/runtime/values/NativeWrapper.java b/src/java/me/topchetoeu/jscript/runtime/values/NativeWrapper.java index fcce54e..2050342 100644 --- a/src/java/me/topchetoeu/jscript/runtime/values/NativeWrapper.java +++ b/src/java/me/topchetoeu/jscript/runtime/values/NativeWrapper.java @@ -9,8 +9,13 @@ public class NativeWrapper extends ObjectValue { @Override public ObjectValue getPrototype(Context ctx) { if (ctx.environment != null && prototype == NATIVE_PROTO) { - var res = ctx.environment.wrappers.getProto(wrapped.getClass()); - if (res != null) return res; + var clazz = wrapped.getClass(); + + while (true) { + var res = ctx.environment.wrappers.getProto(clazz); + if (res != null) return res; + clazz = clazz.getSuperclass(); + } } return super.getPrototype(ctx); }