Просмотр исходного кода

Rename DataViewInstance to JsDataView (#1593)

Marko Lahma 2 лет назад
Родитель
Сommit
0163e1a5b7

+ 1 - 1
Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs

@@ -54,7 +54,7 @@ namespace Jint.Native.ArrayBuffer
         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;
         }
 
         /// <summary>

+ 2 - 2
Jint/Native/DataView/DataViewConstructor.cs

@@ -26,7 +26,7 @@ namespace Jint.Native.DataView
             _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 @@ namespace Jint.Native.DataView
             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)
             {

+ 5 - 5
Jint/Native/DataView/DataViewPrototype.cs

@@ -70,7 +70,7 @@ namespace Jint.Native.DataView
         /// </summary>
         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 @@ namespace Jint.Native.DataView
         /// </summary>
         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 @@ namespace Jint.Native.DataView
         /// </summary>
         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 @@ namespace Jint.Native.DataView
             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 @@ namespace Jint.Native.DataView
             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);

+ 2 - 2
Jint/Native/DataView/DataViewInstance.cs → Jint/Native/DataView/JsDataView.cs

@@ -6,13 +6,13 @@ namespace Jint.Native.DataView;
 /// <summary>
 /// https://tc39.es/ecma262/#sec-properties-of-dataview-instances
 /// </summary>
-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)
     {
     }
 }