From 568905202615af8c1ce47933c6b521baddda2fc8 Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Mon, 31 Jul 2023 09:11:02 +0300 Subject: [PATCH] Rename ProxyInstance to JsProxy (#1604) --- Jint/Native/Function/FunctionInstance.cs | 2 +- Jint/Native/Json/JsonSerializer.cs | 2 +- Jint/Native/Object/ObjectPrototype.cs | 2 +- Jint/Native/Proxy/{ProxyInstance.cs => JsProxy.cs} | 4 ++-- Jint/Native/Proxy/ProxyConstructor.cs | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) rename Jint/Native/Proxy/{ProxyInstance.cs => JsProxy.cs} (99%) diff --git a/Jint/Native/Function/FunctionInstance.cs b/Jint/Native/Function/FunctionInstance.cs index 0670f6f135..44ec6525ac 100644 --- a/Jint/Native/Function/FunctionInstance.cs +++ b/Jint/Native/Function/FunctionInstance.cs @@ -257,7 +257,7 @@ internal Realm GetFunctionRealm(JsValue obj) return GetFunctionRealm(bindFunctionInstance.BoundTargetFunction); } - if (obj is ProxyInstance proxyInstance) + if (obj is JsProxy proxyInstance) { if (proxyInstance._handler is null) { diff --git a/Jint/Native/Json/JsonSerializer.cs b/Jint/Native/Json/JsonSerializer.cs index 3f2deb79a9..fe17770993 100644 --- a/Jint/Native/Json/JsonSerializer.cs +++ b/Jint/Native/Json/JsonSerializer.cs @@ -285,7 +285,7 @@ private static bool CanSerializesAsArray(ObjectInstance value) return true; } - if (value is ProxyInstance proxyInstance && CanSerializesAsArray(proxyInstance._target)) + if (value is JsProxy proxyInstance && CanSerializesAsArray(proxyInstance._target)) { return true; } diff --git a/Jint/Native/Object/ObjectPrototype.cs b/Jint/Native/Object/ObjectPrototype.cs index 6dfa827509..9dbaa826df 100644 --- a/Jint/Native/Object/ObjectPrototype.cs +++ b/Jint/Native/Object/ObjectPrototype.cs @@ -269,7 +269,7 @@ internal JsValue ToObjectString(JsValue thisObject, JsValue[] arguments) } else { - tag = (o is ProxyInstance ? ObjectClass.Object : o.Class).ToString(); + tag = (o is JsProxy ? ObjectClass.Object : o.Class).ToString(); } } diff --git a/Jint/Native/Proxy/ProxyInstance.cs b/Jint/Native/Proxy/JsProxy.cs similarity index 99% rename from Jint/Native/Proxy/ProxyInstance.cs rename to Jint/Native/Proxy/JsProxy.cs index db0f721663..463cf05529 100644 --- a/Jint/Native/Proxy/ProxyInstance.cs +++ b/Jint/Native/Proxy/JsProxy.cs @@ -5,7 +5,7 @@ namespace Jint.Native.Proxy { - internal sealed class ProxyInstance : ObjectInstance, IConstructor, ICallable + internal sealed class JsProxy : ObjectInstance, IConstructor, ICallable { internal ObjectInstance _target; internal ObjectInstance? _handler; @@ -27,7 +27,7 @@ internal sealed class ProxyInstance : ObjectInstance, IConstructor, ICallable private static readonly JsString KeyFunctionRevoke = new JsString("revoke"); private static readonly JsString KeyIsArray = new JsString("isArray"); - public ProxyInstance( + public JsProxy( Engine engine, ObjectInstance target, ObjectInstance handler) diff --git a/Jint/Native/Proxy/ProxyConstructor.cs b/Jint/Native/Proxy/ProxyConstructor.cs index 4d0950337d..d06fdcd237 100644 --- a/Jint/Native/Proxy/ProxyConstructor.cs +++ b/Jint/Native/Proxy/ProxyConstructor.cs @@ -50,7 +50,7 @@ public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget) /// /// https://tc39.es/ecma262/#sec-proxy-target-handler /// - public ProxyInstance Construct(JsValue target, JsValue handler) + public JsProxy Construct(JsValue target, JsValue handler) { return ProxyCreate(target, handler); } @@ -78,7 +78,7 @@ JsValue Revoke(JsValue thisObject, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-proxycreate /// - private ProxyInstance ProxyCreate(JsValue target, JsValue handler) + private JsProxy ProxyCreate(JsValue target, JsValue handler) { if (target is not ObjectInstance targetObject) { @@ -92,7 +92,7 @@ private ProxyInstance ProxyCreate(JsValue target, JsValue handler) return null; } - var p = new ProxyInstance(Engine, targetObject, targetHandler); + var p = new JsProxy(Engine, targetObject, targetHandler); return p; } }