From 0163e1a5b788e751dbe425d3cba7bc80540ed1a8 Mon Sep 17 00:00:00 2001 From: Marko Lahma Date: Fri, 28 Jul 2023 21:46:58 +0300 Subject: [PATCH] Rename DataViewInstance to JsDataView (#1593) --- Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs | 2 +- Jint/Native/DataView/DataViewConstructor.cs | 4 ++-- Jint/Native/DataView/DataViewPrototype.cs | 10 +++++----- .../DataView/{DataViewInstance.cs => JsDataView.cs} | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) rename Jint/Native/DataView/{DataViewInstance.cs => JsDataView.cs} (72%) diff --git a/Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs b/Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs index f141600baa..e2c49877f1 100644 --- a/Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs +++ b/Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs @@ -54,7 +54,7 @@ protected override void Initialize() private static JsValue IsView(JsValue thisObject, JsValue[] arguments) { var arg = arguments.At(0); - return arg is DataViewInstance or JsTypedArray; + return arg is JsDataView or JsTypedArray; } /// diff --git a/Jint/Native/DataView/DataViewConstructor.cs b/Jint/Native/DataView/DataViewConstructor.cs index 2d14e17e10..5c2863b1df 100644 --- a/Jint/Native/DataView/DataViewConstructor.cs +++ b/Jint/Native/DataView/DataViewConstructor.cs @@ -26,7 +26,7 @@ internal DataViewConstructor( _prototypeDescriptor = new PropertyDescriptor(PrototypeObject, PropertyFlag.AllForbidden); } - public DataViewPrototype PrototypeObject { get; } + private DataViewPrototype PrototypeObject { get; } public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget) { @@ -74,7 +74,7 @@ public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget) var o = OrdinaryCreateFromConstructor( newTarget, static intrinsics => intrinsics.DataView.PrototypeObject, - static (Engine engine, Realm _, object? _) => new DataViewInstance(engine)); + static (Engine engine, Realm _, object? _) => new JsDataView(engine)); if (buffer.IsDetachedBuffer) { diff --git a/Jint/Native/DataView/DataViewPrototype.cs b/Jint/Native/DataView/DataViewPrototype.cs index 2cd12b5ab9..1fcf80be47 100644 --- a/Jint/Native/DataView/DataViewPrototype.cs +++ b/Jint/Native/DataView/DataViewPrototype.cs @@ -70,7 +70,7 @@ protected override void Initialize() /// private JsValue Buffer(JsValue thisObj, JsValue[] arguments) { - var o = thisObj as DataViewInstance; + var o = thisObj as JsDataView; if (o is null) { ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.buffer called on incompatible receiver " + thisObj); @@ -84,7 +84,7 @@ private JsValue Buffer(JsValue thisObj, JsValue[] arguments) /// private JsValue ByteLength(JsValue thisObj, JsValue[] arguments) { - var o = thisObj as DataViewInstance; + var o = thisObj as JsDataView; if (o is null) { ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.byteLength called on incompatible receiver " + thisObj); @@ -101,7 +101,7 @@ private JsValue ByteLength(JsValue thisObj, JsValue[] arguments) /// private JsValue ByteOffset(JsValue thisObj, JsValue[] arguments) { - var o = thisObj as DataViewInstance; + var o = thisObj as JsDataView; if (o is null) { ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.byteOffset called on incompatible receiver " + thisObj); @@ -222,7 +222,7 @@ private JsValue GetViewValue( JsValue isLittleEndian, TypedArrayElementType type) { - var dataView = view as DataViewInstance; + var dataView = view as JsDataView; if (dataView is null) { ExceptionHelper.ThrowTypeError(_realm, "Method called on incompatible receiver " + view); @@ -256,7 +256,7 @@ private JsValue SetViewValue( TypedArrayElementType type, JsValue value) { - var dataView = view as DataViewInstance; + var dataView = view as JsDataView; if (dataView is null) { ExceptionHelper.ThrowTypeError(_realm, "Method called on incompatible receiver " + view); diff --git a/Jint/Native/DataView/DataViewInstance.cs b/Jint/Native/DataView/JsDataView.cs similarity index 72% rename from Jint/Native/DataView/DataViewInstance.cs rename to Jint/Native/DataView/JsDataView.cs index eff16b1ff4..4930b72d24 100644 --- a/Jint/Native/DataView/DataViewInstance.cs +++ b/Jint/Native/DataView/JsDataView.cs @@ -6,13 +6,13 @@ namespace Jint.Native.DataView; /// /// https://tc39.es/ecma262/#sec-properties-of-dataview-instances /// -internal sealed class DataViewInstance : ObjectInstance +internal sealed class JsDataView : ObjectInstance { internal JsArrayBuffer? _viewedArrayBuffer; internal uint _byteLength; internal uint _byteOffset; - internal DataViewInstance(Engine engine) : base(engine) + internal JsDataView(Engine engine) : base(engine) { } }