Browse Source

Rename TypedArrayInstance to JsTypedArray (#1592)

Marko Lahma 2 years ago
parent
commit
b48e7b7180

+ 18 - 18
Jint/JsValueExtensions.cs

@@ -242,7 +242,7 @@ namespace Jint
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool IsUint8Array(this JsValue value)
         public static bool IsUint8Array(this JsValue value)
         {
         {
-            return value is TypedArrayInstance { _arrayElementType: TypedArrayElementType.Uint8 };
+            return value is JsTypedArray { _arrayElementType: TypedArrayElementType.Uint8 };
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -253,13 +253,13 @@ namespace Jint
                 ThrowWrongTypeException(value, "Uint8Array");
                 ThrowWrongTypeException(value, "Uint8Array");
             }
             }
 
 
-            return ((TypedArrayInstance) value).ToNativeArray<byte>();
+            return ((JsTypedArray) value).ToNativeArray<byte>();
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool IsUint8ClampedArray(this JsValue value)
         public static bool IsUint8ClampedArray(this JsValue value)
         {
         {
-            return value is TypedArrayInstance { _arrayElementType: TypedArrayElementType.Uint8C };
+            return value is JsTypedArray { _arrayElementType: TypedArrayElementType.Uint8C };
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -270,13 +270,13 @@ namespace Jint
                 ThrowWrongTypeException(value, "Uint8ClampedArray");
                 ThrowWrongTypeException(value, "Uint8ClampedArray");
             }
             }
 
 
-            return ((TypedArrayInstance) value).ToNativeArray<byte>();
+            return ((JsTypedArray) value).ToNativeArray<byte>();
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool IsInt8Array(this JsValue value)
         public static bool IsInt8Array(this JsValue value)
         {
         {
-            return value is TypedArrayInstance { _arrayElementType: TypedArrayElementType.Int8 };
+            return value is JsTypedArray { _arrayElementType: TypedArrayElementType.Int8 };
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -287,13 +287,13 @@ namespace Jint
                 ThrowWrongTypeException(value, "Int8Array");
                 ThrowWrongTypeException(value, "Int8Array");
             }
             }
 
 
-            return ((TypedArrayInstance) value).ToNativeArray<sbyte>();
+            return ((JsTypedArray) value).ToNativeArray<sbyte>();
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool IsInt16Array(this JsValue value)
         public static bool IsInt16Array(this JsValue value)
         {
         {
-            return value is TypedArrayInstance { _arrayElementType: TypedArrayElementType.Int16 };
+            return value is JsTypedArray { _arrayElementType: TypedArrayElementType.Int16 };
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -304,13 +304,13 @@ namespace Jint
                 ThrowWrongTypeException(value, "Int16Array");
                 ThrowWrongTypeException(value, "Int16Array");
             }
             }
 
 
-            return ((TypedArrayInstance) value).ToNativeArray<short>();
+            return ((JsTypedArray) value).ToNativeArray<short>();
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool IsUint16Array(this JsValue value)
         public static bool IsUint16Array(this JsValue value)
         {
         {
-            return value is TypedArrayInstance { _arrayElementType: TypedArrayElementType.Uint16 };
+            return value is JsTypedArray { _arrayElementType: TypedArrayElementType.Uint16 };
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -321,13 +321,13 @@ namespace Jint
                 ThrowWrongTypeException(value, "Uint16Array");
                 ThrowWrongTypeException(value, "Uint16Array");
             }
             }
 
 
-            return ((TypedArrayInstance) value).ToNativeArray<ushort>();
+            return ((JsTypedArray) value).ToNativeArray<ushort>();
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool IsInt32Array(this JsValue value)
         public static bool IsInt32Array(this JsValue value)
         {
         {
-            return value is TypedArrayInstance { _arrayElementType: TypedArrayElementType.Int32 };
+            return value is JsTypedArray { _arrayElementType: TypedArrayElementType.Int32 };
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -338,13 +338,13 @@ namespace Jint
                 ThrowWrongTypeException(value, "Int32Array");
                 ThrowWrongTypeException(value, "Int32Array");
             }
             }
 
 
-            return ((TypedArrayInstance) value).ToNativeArray<int>();
+            return ((JsTypedArray) value).ToNativeArray<int>();
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool IsUint32Array(this JsValue value)
         public static bool IsUint32Array(this JsValue value)
         {
         {
-            return value is TypedArrayInstance { _arrayElementType: TypedArrayElementType.Uint32 };
+            return value is JsTypedArray { _arrayElementType: TypedArrayElementType.Uint32 };
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -355,13 +355,13 @@ namespace Jint
                 ThrowWrongTypeException(value, "Uint32Array");
                 ThrowWrongTypeException(value, "Uint32Array");
             }
             }
 
 
-            return ((TypedArrayInstance) value).ToNativeArray<uint>();
+            return ((JsTypedArray) value).ToNativeArray<uint>();
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool IsBigInt64Array(this JsValue value)
         public static bool IsBigInt64Array(this JsValue value)
         {
         {
-            return value is TypedArrayInstance { _arrayElementType: TypedArrayElementType.BigInt64 };
+            return value is JsTypedArray { _arrayElementType: TypedArrayElementType.BigInt64 };
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -372,13 +372,13 @@ namespace Jint
                 ThrowWrongTypeException(value, "BigInt64Array");
                 ThrowWrongTypeException(value, "BigInt64Array");
             }
             }
 
 
-            return ((TypedArrayInstance) value).ToNativeArray<long>();
+            return ((JsTypedArray) value).ToNativeArray<long>();
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static bool IsBigUint64Array(this JsValue value)
         public static bool IsBigUint64Array(this JsValue value)
         {
         {
-            return value is TypedArrayInstance { _arrayElementType: TypedArrayElementType.BigUint64 };
+            return value is JsTypedArray { _arrayElementType: TypedArrayElementType.BigUint64 };
         }
         }
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -389,7 +389,7 @@ namespace Jint
                 ThrowWrongTypeException(value, "BigUint64Array");
                 ThrowWrongTypeException(value, "BigUint64Array");
             }
             }
 
 
-            return ((TypedArrayInstance) value).ToNativeArray<ulong>();
+            return ((JsTypedArray) value).ToNativeArray<ulong>();
         }
         }
 
 
         [Pure]
         [Pure]

+ 2 - 2
Jint/Native/Array/ArrayIteratorPrototype.cs

@@ -86,7 +86,7 @@ internal sealed class ArrayIteratorPrototype : IteratorPrototype
     private sealed class ArrayLikeIterator : IteratorInstance
     private sealed class ArrayLikeIterator : IteratorInstance
     {
     {
         private readonly ArrayIteratorType _kind;
         private readonly ArrayIteratorType _kind;
-        private readonly TypedArrayInstance? _typedArray;
+        private readonly JsTypedArray? _typedArray;
         private readonly ArrayOperations? _operations;
         private readonly ArrayOperations? _operations;
         private uint _position;
         private uint _position;
         private bool _closed;
         private bool _closed;
@@ -94,7 +94,7 @@ internal sealed class ArrayIteratorPrototype : IteratorPrototype
         public ArrayLikeIterator(Engine engine, ObjectInstance objectInstance, ArrayIteratorType kind) : base(engine)
         public ArrayLikeIterator(Engine engine, ObjectInstance objectInstance, ArrayIteratorType kind) : base(engine)
         {
         {
             _kind = kind;
             _kind = kind;
-            _typedArray = objectInstance as TypedArrayInstance;
+            _typedArray = objectInstance as JsTypedArray;
             if (_typedArray is null)
             if (_typedArray is null)
             {
             {
                 _operations = ArrayOperations.For(objectInstance);
                 _operations = ArrayOperations.For(objectInstance);

+ 3 - 3
Jint/Native/Array/ArrayOperations.cs

@@ -19,7 +19,7 @@ namespace Jint.Native.Array
                 return new ArrayInstanceOperations(arrayInstance);
                 return new ArrayInstanceOperations(arrayInstance);
             }
             }
 
 
-            if (instance is TypedArrayInstance typedArrayInstance)
+            if (instance is JsTypedArray typedArrayInstance)
             {
             {
                 return new TypedArrayInstanceOperations(typedArrayInstance);
                 return new TypedArrayInstanceOperations(typedArrayInstance);
             }
             }
@@ -277,9 +277,9 @@ namespace Jint.Native.Array
 
 
         private sealed class TypedArrayInstanceOperations : ArrayOperations
         private sealed class TypedArrayInstanceOperations : ArrayOperations
         {
         {
-            private readonly TypedArrayInstance _target;
+            private readonly JsTypedArray _target;
 
 
-            public TypedArrayInstanceOperations(TypedArrayInstance target)
+            public TypedArrayInstanceOperations(JsTypedArray target)
             {
             {
                 _target = target;
                 _target = target;
             }
             }

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

@@ -54,7 +54,7 @@ namespace Jint.Native.ArrayBuffer
         private static JsValue IsView(JsValue thisObject, JsValue[] arguments)
         private static JsValue IsView(JsValue thisObject, JsValue[] arguments)
         {
         {
             var arg = arguments.At(0);
             var arg = arguments.At(0);
-            return arg is DataViewInstance or TypedArrayInstance;
+            return arg is DataViewInstance or JsTypedArray;
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 2 - 2
Jint/Native/TypedArray/IntrinsicTypedArrayConstructor.cs

@@ -147,7 +147,7 @@ namespace Jint.Native.TypedArray
         /// <summary>
         /// <summary>
         /// https://tc39.es/ecma262/#typedarray-species-create
         /// https://tc39.es/ecma262/#typedarray-species-create
         /// </summary>
         /// </summary>
-        internal TypedArrayInstance TypedArraySpeciesCreate(TypedArrayInstance exemplar, JsValue[] argumentList)
+        internal JsTypedArray TypedArraySpeciesCreate(JsTypedArray exemplar, JsValue[] argumentList)
         {
         {
             var defaultConstructor = exemplar._arrayElementType.GetConstructor(_realm.Intrinsics)!;
             var defaultConstructor = exemplar._arrayElementType.GetConstructor(_realm.Intrinsics)!;
             var constructor = SpeciesConstructor(exemplar, defaultConstructor);
             var constructor = SpeciesConstructor(exemplar, defaultConstructor);
@@ -163,7 +163,7 @@ namespace Jint.Native.TypedArray
         /// <summary>
         /// <summary>
         /// https://tc39.es/ecma262/#typedarray-create
         /// https://tc39.es/ecma262/#typedarray-create
         /// </summary>
         /// </summary>
-        internal static TypedArrayInstance TypedArrayCreate(Realm realm, IConstructor constructor, JsValue[] argumentList)
+        internal static JsTypedArray TypedArrayCreate(Realm realm, IConstructor constructor, JsValue[] argumentList)
         {
         {
             var newTypedArray = Construct(constructor, argumentList).ValidateTypedArray(realm);
             var newTypedArray = Construct(constructor, argumentList).ValidateTypedArray(realm);
             if (argumentList.Length == 1 && argumentList[0] is JsNumber number)
             if (argumentList.Length == 1 && argumentList[0] is JsNumber number)

+ 12 - 12
Jint/Native/TypedArray/IntrinsicTypedArrayPrototype.cs

@@ -89,7 +89,7 @@ namespace Jint.Native.TypedArray
         /// </summary>
         /// </summary>
         private JsValue Buffer(JsValue thisObj, JsValue[] arguments)
         private JsValue Buffer(JsValue thisObj, JsValue[] arguments)
         {
         {
-            var o = thisObj as TypedArrayInstance;
+            var o = thisObj as JsTypedArray;
             if (o is null)
             if (o is null)
             {
             {
                 ExceptionHelper.ThrowTypeError(_realm);
                 ExceptionHelper.ThrowTypeError(_realm);
@@ -103,7 +103,7 @@ namespace Jint.Native.TypedArray
         /// </summary>
         /// </summary>
         private JsValue ByteLength(JsValue thisObj, JsValue[] arguments)
         private JsValue ByteLength(JsValue thisObj, JsValue[] arguments)
         {
         {
-            var o = thisObj as TypedArrayInstance;
+            var o = thisObj as JsTypedArray;
             if (o is null)
             if (o is null)
             {
             {
                 ExceptionHelper.ThrowTypeError(_realm);
                 ExceptionHelper.ThrowTypeError(_realm);
@@ -122,7 +122,7 @@ namespace Jint.Native.TypedArray
         /// </summary>
         /// </summary>
         private JsValue ByteOffset(JsValue thisObj, JsValue[] arguments)
         private JsValue ByteOffset(JsValue thisObj, JsValue[] arguments)
         {
         {
-            var o = thisObj as TypedArrayInstance;
+            var o = thisObj as JsTypedArray;
             if (o is null)
             if (o is null)
             {
             {
                 ExceptionHelper.ThrowTypeError(_realm);
                 ExceptionHelper.ThrowTypeError(_realm);
@@ -141,7 +141,7 @@ namespace Jint.Native.TypedArray
         /// </summary>
         /// </summary>
         private JsValue GetLength(JsValue thisObj, JsValue[] arguments)
         private JsValue GetLength(JsValue thisObj, JsValue[] arguments)
         {
         {
-            var o = thisObj as TypedArrayInstance;
+            var o = thisObj as JsTypedArray;
             if (o is null)
             if (o is null)
             {
             {
                 ExceptionHelper.ThrowTypeError(_realm);
                 ExceptionHelper.ThrowTypeError(_realm);
@@ -846,7 +846,7 @@ namespace Jint.Native.TypedArray
         /// </summary>
         /// </summary>
         private JsValue Set(JsValue thisObj, JsValue[] arguments)
         private JsValue Set(JsValue thisObj, JsValue[] arguments)
         {
         {
-            var target = thisObj as TypedArrayInstance;
+            var target = thisObj as JsTypedArray;
             if (target is null)
             if (target is null)
             {
             {
                 ExceptionHelper.ThrowTypeError(_realm);
                 ExceptionHelper.ThrowTypeError(_realm);
@@ -861,7 +861,7 @@ namespace Jint.Native.TypedArray
                 ExceptionHelper.ThrowRangeError(_realm, "Invalid offset");
                 ExceptionHelper.ThrowRangeError(_realm, "Invalid offset");
             }
             }
 
 
-            if (source is TypedArrayInstance typedArrayInstance)
+            if (source is JsTypedArray typedArrayInstance)
             {
             {
                 SetTypedArrayFromTypedArray(target, targetOffset, typedArrayInstance);
                 SetTypedArrayFromTypedArray(target, targetOffset, typedArrayInstance);
             }
             }
@@ -876,7 +876,7 @@ namespace Jint.Native.TypedArray
         /// <summary>
         /// <summary>
         /// https://tc39.es/ecma262/#sec-settypedarrayfromtypedarray
         /// https://tc39.es/ecma262/#sec-settypedarrayfromtypedarray
         /// </summary>
         /// </summary>
-        private void SetTypedArrayFromTypedArray(TypedArrayInstance target, double targetOffset, TypedArrayInstance source)
+        private void SetTypedArrayFromTypedArray(JsTypedArray target, double targetOffset, JsTypedArray source)
         {
         {
             var targetBuffer = target._viewedArrayBuffer;
             var targetBuffer = target._viewedArrayBuffer;
             targetBuffer.AssertNotDetached();
             targetBuffer.AssertNotDetached();
@@ -963,7 +963,7 @@ namespace Jint.Native.TypedArray
         /// <summary>
         /// <summary>
         /// https://tc39.es/ecma262/#sec-settypedarrayfromarraylike
         /// https://tc39.es/ecma262/#sec-settypedarrayfromarraylike
         /// </summary>
         /// </summary>
-        private void SetTypedArrayFromArrayLike(TypedArrayInstance target, int targetOffset, JsValue source)
+        private void SetTypedArrayFromArrayLike(JsTypedArray target, int targetOffset, JsValue source)
         {
         {
             var targetBuffer = target._viewedArrayBuffer;
             var targetBuffer = target._viewedArrayBuffer;
             targetBuffer.AssertNotDetached();
             targetBuffer.AssertNotDetached();
@@ -1170,7 +1170,7 @@ namespace Jint.Native.TypedArray
         /// </summary>
         /// </summary>
         private JsValue Subarray(JsValue thisObj, JsValue[] arguments)
         private JsValue Subarray(JsValue thisObj, JsValue[] arguments)
         {
         {
-            var o = thisObj as TypedArrayInstance;
+            var o = thisObj as JsTypedArray;
             if (o is null)
             if (o is null)
             {
             {
                 ExceptionHelper.ThrowTypeError(_realm);
                 ExceptionHelper.ThrowTypeError(_realm);
@@ -1299,7 +1299,7 @@ namespace Jint.Native.TypedArray
         /// </summary>
         /// </summary>
         private static JsValue ToStringTag(JsValue thisObj, JsValue[] arguments)
         private static JsValue ToStringTag(JsValue thisObj, JsValue[] arguments)
         {
         {
-            if (thisObj is not TypedArrayInstance o)
+            if (thisObj is not JsTypedArray o)
             {
             {
                 return Undefined;
                 return Undefined;
             }
             }
@@ -1381,7 +1381,7 @@ namespace Jint.Native.TypedArray
             return a;
             return a;
         }
         }
 
 
-        private TypedArrayInstance TypedArrayCreateSameType(TypedArrayInstance exemplar, JsValue[] argumentList)
+        private JsTypedArray TypedArrayCreateSameType(JsTypedArray exemplar, JsValue[] argumentList)
         {
         {
             var constructor = exemplar._arrayElementType.GetConstructor(_realm.Intrinsics);
             var constructor = exemplar._arrayElementType.GetConstructor(_realm.Intrinsics);
             var result = IntrinsicTypedArrayConstructor.TypedArrayCreate(_realm, constructor, argumentList);
             var result = IntrinsicTypedArrayConstructor.TypedArrayCreate(_realm, constructor, argumentList);
@@ -1404,7 +1404,7 @@ namespace Jint.Native.TypedArray
             return compareFn;
             return compareFn;
         }
         }
 
 
-        private static JsValue[] SortArray(JsArrayBuffer buffer, ICallable? compareFn, TypedArrayInstance obj)
+        private static JsValue[] SortArray(JsArrayBuffer buffer, ICallable? compareFn, JsTypedArray obj)
         {
         {
             var comparer = TypedArrayComparer.WithFunction(buffer, compareFn);
             var comparer = TypedArrayComparer.WithFunction(buffer, compareFn);
             var operations = ArrayOperations.For(obj);
             var operations = ArrayOperations.For(obj);

+ 2 - 2
Jint/Native/TypedArray/TypedArrayInstance.cs → Jint/Native/TypedArray/JsTypedArray.cs

@@ -8,7 +8,7 @@ using Jint.Runtime.Descriptors;
 
 
 namespace Jint.Native.TypedArray
 namespace Jint.Native.TypedArray
 {
 {
-    public sealed class TypedArrayInstance : ObjectInstance
+    public sealed class JsTypedArray : ObjectInstance
     {
     {
         internal readonly TypedArrayContentType _contentType;
         internal readonly TypedArrayContentType _contentType;
         internal readonly TypedArrayElementType _arrayElementType;
         internal readonly TypedArrayElementType _arrayElementType;
@@ -18,7 +18,7 @@ namespace Jint.Native.TypedArray
         private readonly Intrinsics _intrinsics;
         private readonly Intrinsics _intrinsics;
         internal uint _arrayLength;
         internal uint _arrayLength;
 
 
-        internal TypedArrayInstance(
+        internal JsTypedArray(
             Engine engine,
             Engine engine,
             Intrinsics intrinsics,
             Intrinsics intrinsics,
             TypedArrayElementType type,
             TypedArrayElementType type,

+ 2 - 2
Jint/Native/TypedArray/TypeArrayHelper.cs

@@ -4,9 +4,9 @@ namespace Jint.Native.TypedArray;
 
 
 internal static class TypeArrayHelper
 internal static class TypeArrayHelper
 {
 {
-    internal static TypedArrayInstance ValidateTypedArray(this JsValue o, Realm realm)
+    internal static JsTypedArray ValidateTypedArray(this JsValue o, Realm realm)
     {
     {
-        var typedArrayInstance = o as TypedArrayInstance;
+        var typedArrayInstance = o as JsTypedArray;
         if (typedArrayInstance is null)
         if (typedArrayInstance is null)
         {
         {
             ExceptionHelper.ThrowTypeError(realm);
             ExceptionHelper.ThrowTypeError(realm);

+ 22 - 22
Jint/Native/TypedArray/TypedArrayConstructor.Types.cs

@@ -12,9 +12,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(sbyte[] values)
+        public JsTypedArray Construct(sbyte[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }
@@ -30,9 +30,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(byte[] values)
+        public JsTypedArray Construct(byte[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }
@@ -48,9 +48,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(byte[] values)
+        public JsTypedArray Construct(byte[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }
@@ -66,9 +66,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(short[] values)
+        public JsTypedArray Construct(short[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }
@@ -84,9 +84,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(ushort[] values)
+        public JsTypedArray Construct(ushort[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }
@@ -102,9 +102,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(int[] values)
+        public JsTypedArray Construct(int[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }
@@ -120,9 +120,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(uint[] values)
+        public JsTypedArray Construct(uint[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }
@@ -138,9 +138,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(float[] values)
+        public JsTypedArray Construct(float[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }
@@ -156,9 +156,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(double[] values)
+        public JsTypedArray Construct(double[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }
@@ -174,9 +174,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(long[] values)
+        public JsTypedArray Construct(long[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }
@@ -192,9 +192,9 @@ namespace Jint.Native.TypedArray
         {
         {
         }
         }
 
 
-        public TypedArrayInstance Construct(ulong[] values)
+        public JsTypedArray Construct(ulong[] values)
         {
         {
-            var array = (TypedArrayInstance) base.Construct(new JsValue[] { values.Length }, this);
+            var array = (JsTypedArray) base.Construct(new JsValue[] { values.Length }, this);
             FillTypedArrayInstance(array, values);
             FillTypedArrayInstance(array, values);
             return array;
             return array;
         }
         }

+ 10 - 10
Jint/Native/TypedArray/TypedArrayConstructor.cs

@@ -74,7 +74,7 @@ namespace Jint.Native.TypedArray
             if (firstArgument.IsObject())
             if (firstArgument.IsObject())
             {
             {
                 var o = AllocateTypedArray(newTarget, proto);
                 var o = AllocateTypedArray(newTarget, proto);
-                if (firstArgument is TypedArrayInstance typedArrayInstance)
+                if (firstArgument is JsTypedArray typedArrayInstance)
                 {
                 {
                     InitializeTypedArrayFromTypedArray(o, typedArrayInstance);
                     InitializeTypedArrayFromTypedArray(o, typedArrayInstance);
                 }
                 }
@@ -123,7 +123,7 @@ namespace Jint.Native.TypedArray
         /// <summary>
         /// <summary>
         /// https://tc39.es/ecma262/#sec-initializetypedarrayfromtypedarray
         /// https://tc39.es/ecma262/#sec-initializetypedarrayfromtypedarray
         /// </summary>
         /// </summary>
-        private void InitializeTypedArrayFromTypedArray(TypedArrayInstance o, TypedArrayInstance srcArray)
+        private void InitializeTypedArrayFromTypedArray(JsTypedArray o, JsTypedArray srcArray)
         {
         {
             var srcData = srcArray._viewedArrayBuffer;
             var srcData = srcArray._viewedArrayBuffer;
             srcData.AssertNotDetached();
             srcData.AssertNotDetached();
@@ -174,7 +174,7 @@ namespace Jint.Native.TypedArray
         /// https://tc39.es/ecma262/#sec-initializetypedarrayfromarraybuffer
         /// https://tc39.es/ecma262/#sec-initializetypedarrayfromarraybuffer
         /// </summary>
         /// </summary>
         private void InitializeTypedArrayFromArrayBuffer(
         private void InitializeTypedArrayFromArrayBuffer(
-            TypedArrayInstance o,
+            JsTypedArray o,
             JsArrayBuffer buffer,
             JsArrayBuffer buffer,
             JsValue byteOffset,
             JsValue byteOffset,
             JsValue length)
             JsValue length)
@@ -224,7 +224,7 @@ namespace Jint.Native.TypedArray
             o._byteOffset = offset;
             o._byteOffset = offset;
         }
         }
 
 
-        private static void InitializeTypedArrayFromList(TypedArrayInstance o, List<JsValue> values)
+        private static void InitializeTypedArrayFromList(JsTypedArray o, List<JsValue> values)
         {
         {
             var len = values.Count;
             var len = values.Count;
             o.AllocateTypedArrayBuffer((uint) len);
             o.AllocateTypedArrayBuffer((uint) len);
@@ -237,7 +237,7 @@ namespace Jint.Native.TypedArray
         /// <summary>
         /// <summary>
         /// https://tc39.es/ecma262/#sec-initializetypedarrayfromarraylike
         /// https://tc39.es/ecma262/#sec-initializetypedarrayfromarraylike
         /// </summary>
         /// </summary>
-        private static void InitializeTypedArrayFromArrayLike(TypedArrayInstance o, ObjectInstance arrayLike)
+        private static void InitializeTypedArrayFromArrayLike(JsTypedArray o, ObjectInstance arrayLike)
         {
         {
             var operations = ArrayOperations.For(arrayLike);
             var operations = ArrayOperations.For(arrayLike);
             var len = operations.GetLongLength();
             var len = operations.GetLongLength();
@@ -251,11 +251,11 @@ namespace Jint.Native.TypedArray
         /// <summary>
         /// <summary>
         /// https://tc39.es/ecma262/#sec-allocatetypedarray
         /// https://tc39.es/ecma262/#sec-allocatetypedarray
         /// </summary>
         /// </summary>
-        private TypedArrayInstance AllocateTypedArray(JsValue newTarget, Func<Intrinsics, ObjectInstance> defaultProto, uint length = 0)
+        private JsTypedArray AllocateTypedArray(JsValue newTarget, Func<Intrinsics, ObjectInstance> defaultProto, uint length = 0)
         {
         {
             var proto = GetPrototypeFromConstructor(newTarget, defaultProto);
             var proto = GetPrototypeFromConstructor(newTarget, defaultProto);
             var realm = GetFunctionRealm(newTarget);
             var realm = GetFunctionRealm(newTarget);
-            var obj = new TypedArrayInstance(_engine, realm.Intrinsics, _arrayElementType, length)
+            var obj = new JsTypedArray(_engine, realm.Intrinsics, _arrayElementType, length)
             {
             {
                 _prototype = proto
                 _prototype = proto
             };
             };
@@ -267,7 +267,7 @@ namespace Jint.Native.TypedArray
             return obj;
             return obj;
         }
         }
 
 
-        internal static void FillTypedArrayInstance<T>(TypedArrayInstance target, T[] values)
+        internal static void FillTypedArrayInstance<T>(JsTypedArray target, T[] values)
         {
         {
             for (var i = 0; i < values.Length; ++i)
             for (var i = 0; i < values.Length; ++i)
             {
             {
@@ -275,7 +275,7 @@ namespace Jint.Native.TypedArray
             }
             }
         }
         }
 
 
-        internal static void FillTypedArrayInstance(TypedArrayInstance target, ulong[] values)
+        internal static void FillTypedArrayInstance(JsTypedArray target, ulong[] values)
         {
         {
             for (var i = 0; i < values.Length; ++i)
             for (var i = 0; i < values.Length; ++i)
             {
             {
@@ -283,7 +283,7 @@ namespace Jint.Native.TypedArray
             }
             }
         }
         }
 
 
-        internal static void FillTypedArrayInstance(TypedArrayInstance target, long[] values)
+        internal static void FillTypedArrayInstance(JsTypedArray target, long[] values)
         {
         {
             for (var i = 0; i < values.Length; ++i)
             for (var i = 0; i < values.Length; ++i)
             {
             {