diff --git a/Jint.Tests/Runtime/Domain/UuidPrototype.cs b/Jint.Tests/Runtime/Domain/UuidPrototype.cs index 9d887218a9..6a1fb8335b 100644 --- a/Jint.Tests/Runtime/Domain/UuidPrototype.cs +++ b/Jint.Tests/Runtime/Domain/UuidPrototype.cs @@ -11,17 +11,14 @@ private UuidPrototype(Engine engine) : base(engine) { } - private UuidInstance EnsureUuidInstance(JsValue thisObj) + private UuidInstance EnsureUuidInstance(JsValue thisObject) { - return thisObj.TryCast(value => - { - throw new JavaScriptException(Engine.Realm.Intrinsics.TypeError, "Invalid Uuid"); - }); + return thisObject.TryCast(value => throw new JavaScriptException(Engine.Realm.Intrinsics.TypeError, "Invalid Uuid")); } - private JsValue ToGuidString(JsValue thisObj, JsValue[] arguments) => EnsureUuidInstance(thisObj).PrimitiveValue.ToString(); + private JsValue ToGuidString(JsValue thisObject, JsValue[] arguments) => EnsureUuidInstance(thisObject).PrimitiveValue.ToString(); - private JsValue ValueOf(JsValue thisObj, JsValue[] arguments) => EnsureUuidInstance(thisObj).PrimitiveValue; + private JsValue ValueOf(JsValue thisObject, JsValue[] arguments) => EnsureUuidInstance(thisObject).PrimitiveValue; public static UuidPrototype CreatePrototypeObject(Engine engine, UuidConstructor ctor) { diff --git a/Jint/Native/Array/ArrayConstructor.cs b/Jint/Native/Array/ArrayConstructor.cs index a4783f81e2..52de03cb64 100644 --- a/Jint/Native/Array/ArrayConstructor.cs +++ b/Jint/Native/Array/ArrayConstructor.cs @@ -49,7 +49,7 @@ protected override void Initialize() /// /// https://tc39.es/ecma262/#sec-array.from /// - private JsValue From(JsValue thisObj, JsValue[] arguments) + private JsValue From(JsValue thisObject, JsValue[] arguments) { var items = arguments.At(0); var mapFunction = arguments.At(1); @@ -65,9 +65,9 @@ private JsValue From(JsValue thisObj, JsValue[] arguments) if (usingIterator is not null) { ObjectInstance instance; - if (!ReferenceEquals(this, thisObj) && thisObj is IConstructor constructor) + if (!ReferenceEquals(this, thisObject) && thisObject is IConstructor constructor) { - instance = constructor.Construct(System.Array.Empty(), thisObj); + instance = constructor.Construct(System.Array.Empty(), thisObject); } else { @@ -86,7 +86,7 @@ private JsValue From(JsValue thisObj, JsValue[] arguments) return ConstructArrayFromIEnumerable(enumerable); } - return ConstructArrayFromArrayLike(thisObj, objectInstance, callable, thisArg); + return ConstructArrayFromArrayLike(thisObject, objectInstance, callable, thisArg); } private ObjectInstance ConstructArrayFromArrayLike( @@ -160,15 +160,15 @@ public ArrayProtocol( _callable = callable; } - protected override void ProcessItem(JsValue[] args, JsValue currentValue) + protected override void ProcessItem(JsValue[] arguments, JsValue currentValue) { _index++; JsValue jsValue; if (!ReferenceEquals(_callable, null)) { - args[0] = currentValue; - args[1] = _index; - jsValue = _callable.Call(_thisArg, args); + arguments[0] = currentValue; + arguments[1] = _index; + jsValue = _callable.Call(_thisArg, arguments); } else { @@ -184,13 +184,13 @@ protected override void IterationEnd() } } - private JsValue Of(JsValue thisObj, JsValue[] arguments) + private JsValue Of(JsValue thisObject, JsValue[] arguments) { var len = arguments.Length; ObjectInstance a; - if (thisObj.IsConstructor) + if (thisObject.IsConstructor) { - a = ((IConstructor) thisObj).Construct(new JsValue[] { len }, thisObj); + a = ((IConstructor) thisObject).Construct(new JsValue[] { len }, thisObject); } else { @@ -227,7 +227,7 @@ private static JsValue Species(JsValue thisObject, JsValue[] arguments) return thisObject; } - private static JsValue IsArray(JsValue thisObj, JsValue[] arguments) + private static JsValue IsArray(JsValue thisObject, JsValue[] arguments) { var o = arguments.At(0); diff --git a/Jint/Native/Array/ArrayPrototype.cs b/Jint/Native/Array/ArrayPrototype.cs index 299223088a..1d48f6e3eb 100644 --- a/Jint/Native/Array/ArrayPrototype.cs +++ b/Jint/Native/Array/ArrayPrototype.cs @@ -115,9 +115,9 @@ protected override void Initialize() SetSymbols(symbols); } - private ObjectInstance Keys(JsValue thisObj, JsValue[] arguments) + private ObjectInstance Keys(JsValue thisObject, JsValue[] arguments) { - if (thisObj is ObjectInstance oi && oi.IsArrayLike) + if (thisObject is ObjectInstance oi && oi.IsArrayLike) { return _realm.Intrinsics.ArrayIteratorPrototype.Construct(oi, ArrayIteratorType.Key); } @@ -126,9 +126,9 @@ private ObjectInstance Keys(JsValue thisObj, JsValue[] arguments) return null; } - internal ObjectInstance Values(JsValue thisObj, JsValue[] arguments) + internal ObjectInstance Values(JsValue thisObject, JsValue[] arguments) { - if (thisObj is ObjectInstance oi && oi.IsArrayLike) + if (thisObject is ObjectInstance oi && oi.IsArrayLike) { return _realm.Intrinsics.ArrayIteratorPrototype.Construct(oi, ArrayIteratorType.Value); } @@ -137,9 +137,9 @@ internal ObjectInstance Values(JsValue thisObj, JsValue[] arguments) return null; } - private ObjectInstance With(JsValue thisObj, JsValue[] arguments) + private ObjectInstance With(JsValue thisObject, JsValue[] arguments) { - var o = ArrayOperations.For(TypeConverter.ToObject(_realm, thisObj)); + var o = ArrayOperations.For(TypeConverter.ToObject(_realm, thisObject)); var len = o.GetLongLength(); var relativeIndex = TypeConverter.ToIntegerOrInfinity(arguments.At(0)); var value = arguments.At(1); @@ -169,9 +169,9 @@ private ObjectInstance With(JsValue thisObj, JsValue[] arguments) return new JsArray(_engine, a); } - private ObjectInstance Entries(JsValue thisObj, JsValue[] arguments) + private ObjectInstance Entries(JsValue thisObject, JsValue[] arguments) { - if (thisObj is ObjectInstance oi && oi.IsArrayLike) + if (thisObject is ObjectInstance oi && oi.IsArrayLike) { return _realm.Intrinsics.ArrayIteratorPrototype.Construct(oi, ArrayIteratorType.KeyAndValue); } @@ -183,13 +183,13 @@ private ObjectInstance Entries(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.fill /// - private JsValue Fill(JsValue thisObj, JsValue[] arguments) + private JsValue Fill(JsValue thisObject, JsValue[] arguments) { var value = arguments.At(0); var start = arguments.At(1); var end = arguments.At(2); - var o = TypeConverter.ToObject(_realm, thisObj); + var o = TypeConverter.ToObject(_realm, thisObject); var operations = ArrayOperations.For(o); var length = operations.GetLongLength(); @@ -236,9 +236,9 @@ private JsValue Fill(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.copywithin /// - private JsValue CopyWithin(JsValue thisObj, JsValue[] arguments) + private JsValue CopyWithin(JsValue thisObject, JsValue[] arguments) { - var o = TypeConverter.ToObject(_realm, thisObj); + var o = TypeConverter.ToObject(_realm, thisObject); JsValue target = arguments.At(0); JsValue start = arguments.At(1); @@ -319,9 +319,9 @@ private JsValue CopyWithin(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.lastindexof /// - private JsValue LastIndexOf(JsValue thisObj, JsValue[] arguments) + private JsValue LastIndexOf(JsValue thisObject, JsValue[] arguments) { - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLongLength(); if (len == 0) { @@ -372,12 +372,12 @@ private JsValue LastIndexOf(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.reduce /// - private JsValue Reduce(JsValue thisObj, JsValue[] arguments) + private JsValue Reduce(JsValue thisObject, JsValue[] arguments) { var callbackfn = arguments.At(0); var initialValue = arguments.At(1); - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLength(); var callable = GetCallable(callbackfn); @@ -434,17 +434,17 @@ private JsValue Reduce(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.filter /// - private JsValue Filter(JsValue thisObj, JsValue[] arguments) + private JsValue Filter(JsValue thisObject, JsValue[] arguments) { var callbackfn = arguments.At(0); var thisArg = arguments.At(1); - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLength(); var callable = GetCallable(callbackfn); - var a = _realm.Intrinsics.Array.ArraySpeciesCreate(TypeConverter.ToObject(_realm, thisObj), 0); + var a = _realm.Intrinsics.Array.ArraySpeciesCreate(TypeConverter.ToObject(_realm, thisObject), 0); var operations = ArrayOperations.For(a); uint to = 0; @@ -474,15 +474,15 @@ private JsValue Filter(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.map /// - private JsValue Map(JsValue thisObj, JsValue[] arguments) + private JsValue Map(JsValue thisObject, JsValue[] arguments) { - if (thisObj is JsArray { CanUseFastAccess: true } arrayInstance + if (thisObject is JsArray { CanUseFastAccess: true } arrayInstance && !arrayInstance.HasOwnProperty(CommonProperties.Constructor)) { return arrayInstance.Map(arguments); } - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLongLength(); if (len > ArrayOperations.MaxArrayLength) @@ -494,7 +494,7 @@ private JsValue Map(JsValue thisObj, JsValue[] arguments) var thisArg = arguments.At(1); var callable = GetCallable(callbackfn); - var a = ArrayOperations.For(_realm.Intrinsics.Array.ArraySpeciesCreate(TypeConverter.ToObject(_realm, thisObj), (uint) len)); + var a = ArrayOperations.For(_realm.Intrinsics.Array.ArraySpeciesCreate(TypeConverter.ToObject(_realm, thisObject), (uint) len)); var args = _engine._jsValueArrayPool.RentArray(3); args[2] = o.Target; for (uint k = 0; k < len; k++) @@ -514,9 +514,9 @@ private JsValue Map(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.flat /// - private JsValue Flat(JsValue thisObj, JsValue[] arguments) + private JsValue Flat(JsValue thisObject, JsValue[] arguments) { - var O = TypeConverter.ToObject(_realm, thisObj); + var O = TypeConverter.ToObject(_realm, thisObject); var operations = ArrayOperations.For(O); var sourceLen = operations.GetLength(); double depthNum = 1; @@ -539,9 +539,9 @@ private JsValue Flat(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.flatmap /// - private JsValue FlatMap(JsValue thisObj, JsValue[] arguments) + private JsValue FlatMap(JsValue thisObject, JsValue[] arguments) { - var O = TypeConverter.ToObject(_realm, thisObj); + var O = TypeConverter.ToObject(_realm, thisObject); var mapperFunction = arguments.At(0); var thisArg = arguments.At(1); @@ -632,12 +632,12 @@ private long FlattenIntoArray( return targetIndex; } - private JsValue ForEach(JsValue thisObj, JsValue[] arguments) + private JsValue ForEach(JsValue thisObject, JsValue[] arguments) { var callbackfn = arguments.At(0); var thisArg = arguments.At(1); - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLength(); var callable = GetCallable(callbackfn); @@ -661,9 +661,9 @@ private JsValue ForEach(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.includes /// - private JsValue Includes(JsValue thisObj, JsValue[] arguments) + private JsValue Includes(JsValue thisObject, JsValue[] arguments) { - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = (long) o.GetLongLength(); if (len == 0) @@ -709,18 +709,18 @@ private JsValue Includes(JsValue thisObj, JsValue[] arguments) return false; } - private JsValue Some(JsValue thisObj, JsValue[] arguments) + private JsValue Some(JsValue thisObject, JsValue[] arguments) { - var target = TypeConverter.ToObject(_realm, thisObj); + var target = TypeConverter.ToObject(_realm, thisObject); return target.FindWithCallback(arguments, out _, out _, false); } /// /// https://tc39.es/ecma262/#sec-array.prototype.every /// - private JsValue Every(JsValue thisObj, JsValue[] arguments) + private JsValue Every(JsValue thisObject, JsValue[] arguments) { - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); ulong len = o.GetLongLength(); if (len == 0) @@ -755,9 +755,9 @@ private JsValue Every(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.indexof /// - private JsValue IndexOf(JsValue thisObj, JsValue[] arguments) + private JsValue IndexOf(JsValue thisObject, JsValue[] arguments) { - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLongLength(); if (len == 0) { @@ -821,9 +821,9 @@ private JsValue IndexOf(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.find /// - private JsValue Find(JsValue thisObj, JsValue[] arguments) + private JsValue Find(JsValue thisObject, JsValue[] arguments) { - var target = TypeConverter.ToObject(_realm, thisObj); + var target = TypeConverter.ToObject(_realm, thisObject); target.FindWithCallback(arguments, out _, out var value, visitUnassigned: true); return value; } @@ -831,9 +831,9 @@ private JsValue Find(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.findindex /// - private JsValue FindIndex(JsValue thisObj, JsValue[] arguments) + private JsValue FindIndex(JsValue thisObject, JsValue[] arguments) { - var target = TypeConverter.ToObject(_realm, thisObj); + var target = TypeConverter.ToObject(_realm, thisObject); if (target.FindWithCallback(arguments, out var index, out _, visitUnassigned: true)) { return index; @@ -841,16 +841,16 @@ private JsValue FindIndex(JsValue thisObj, JsValue[] arguments) return -1; } - private JsValue FindLast(JsValue thisObj, JsValue[] arguments) + private JsValue FindLast(JsValue thisObject, JsValue[] arguments) { - var target = TypeConverter.ToObject(_realm, thisObj); + var target = TypeConverter.ToObject(_realm, thisObject); target.FindWithCallback(arguments, out _, out var value, visitUnassigned: true, fromEnd: true); return value; } - private JsValue FindLastIndex(JsValue thisObj, JsValue[] arguments) + private JsValue FindLastIndex(JsValue thisObject, JsValue[] arguments) { - var target = TypeConverter.ToObject(_realm, thisObj); + var target = TypeConverter.ToObject(_realm, thisObject); if (target.FindWithCallback(arguments, out var index, out _, visitUnassigned: true, fromEnd: true)) { return index; @@ -861,9 +861,9 @@ private JsValue FindLastIndex(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/proposal-relative-indexing-method/#sec-array-prototype-additions /// - private JsValue At(JsValue thisObj, JsValue[] arguments) + private JsValue At(JsValue thisObject, JsValue[] arguments) { - var target = TypeConverter.ToObject(_realm, thisObj); + var target = TypeConverter.ToObject(_realm, thisObject); var len = target.Length; var relativeIndex = TypeConverter.ToInteger(arguments.At(0)); @@ -888,12 +888,12 @@ private JsValue At(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.splice /// - private JsValue Splice(JsValue thisObj, JsValue[] arguments) + private JsValue Splice(JsValue thisObject, JsValue[] arguments) { var start = arguments.At(0); var deleteCount = arguments.At(1); - var obj = TypeConverter.ToObject(_realm, thisObj); + var obj = TypeConverter.ToObject(_realm, thisObject); var o = ArrayOperations.For(_realm, obj); var len = o.GetLongLength(); var relativeStart = TypeConverter.ToInteger(start); @@ -1008,9 +1008,9 @@ private JsValue Splice(JsValue thisObj, JsValue[] arguments) /// /// /https://tc39.es/ecma262/#sec-array.prototype.unshift /// - private JsValue Unshift(JsValue thisObj, JsValue[] arguments) + private JsValue Unshift(JsValue thisObject, JsValue[] arguments) { - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLongLength(); var argCount = (uint) arguments.Length; @@ -1047,9 +1047,9 @@ private JsValue Unshift(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.sort /// - private JsValue Sort(JsValue thisObj, JsValue[] arguments) + private JsValue Sort(JsValue thisObject, JsValue[] arguments) { - var objectInstance = TypeConverter.ToObject(_realm, thisObj); + var objectInstance = TypeConverter.ToObject(_realm, thisObject); var obj = ArrayOperations.For(objectInstance); var compareFn = GetCompareFunction(arguments.At(0)); @@ -1097,12 +1097,12 @@ private JsValue Sort(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.slice /// - private JsValue Slice(JsValue thisObj, JsValue[] arguments) + private JsValue Slice(JsValue thisObject, JsValue[] arguments) { var start = arguments.At(0); var end = arguments.At(1); - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLongLength(); var relativeStart = TypeConverter.ToInteger(start); @@ -1140,8 +1140,8 @@ private JsValue Slice(JsValue thisObj, JsValue[] arguments) } var length = (uint) System.Math.Max(0, (long) final - (long) k); - var a = _realm.Intrinsics.Array.ArraySpeciesCreate(TypeConverter.ToObject(_realm, thisObj), length); - if (thisObj is JsArray ai && a is JsArray a2) + var a = _realm.Intrinsics.Array.ArraySpeciesCreate(TypeConverter.ToObject(_realm, thisObject), length); + if (thisObject is JsArray ai && a is JsArray a2) { a2.CopyValues(ai, (uint) k, 0, length); } @@ -1160,9 +1160,9 @@ private JsValue Slice(JsValue thisObj, JsValue[] arguments) return a; } - private JsValue Shift(JsValue thisObj, JsValue[] arg2) + private JsValue Shift(JsValue thisObject, JsValue[] arg2) { - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLength(); if (len == 0) { @@ -1193,9 +1193,9 @@ private JsValue Shift(JsValue thisObj, JsValue[] arg2) /// /// https://tc39.es/ecma262/#sec-array.prototype.reverse /// - private JsValue Reverse(JsValue thisObj, JsValue[] arguments) + private JsValue Reverse(JsValue thisObject, JsValue[] arguments) { - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLongLength(); var middle = (ulong) System.Math.Floor(len / 2.0); uint lower = 0; @@ -1236,10 +1236,10 @@ private JsValue Reverse(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.join /// - private JsValue Join(JsValue thisObj, JsValue[] arguments) + private JsValue Join(JsValue thisObject, JsValue[] arguments) { var separator = arguments.At(0); - var o = ArrayOperations.For(_realm, thisObj); + var o = ArrayOperations.For(_realm, thisObject); var len = o.GetLength(); var sep = TypeConverter.ToString(separator.IsUndefined() ? JsString.CommaString : separator); @@ -1277,9 +1277,9 @@ static string StringFromJsValue(JsValue value) return sb.ToString(); } - private JsValue ToLocaleString(JsValue thisObj, JsValue[] arguments) + private JsValue ToLocaleString(JsValue thisObject, JsValue[] arguments) { - var array = ArrayOperations.For(_realm, thisObj); + var array = ArrayOperations.For(_realm, thisObject); var len = array.GetLength(); const string Separator = ","; if (len == 0) @@ -1318,14 +1318,14 @@ private JsValue ToLocaleString(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-array.prototype.concat /// - private JsValue Concat(JsValue thisObj, JsValue[] arguments) + private JsValue Concat(JsValue thisObject, JsValue[] arguments) { - var o = TypeConverter.ToObject(_realm, thisObj); + var o = TypeConverter.ToObject(_realm, thisObject); var items = new List(arguments.Length + 1) {o}; items.AddRange(arguments); uint n = 0; - var a = _realm.Intrinsics.Array.ArraySpeciesCreate(TypeConverter.ToObject(_realm, thisObj), 0); + var a = _realm.Intrinsics.Array.ArraySpeciesCreate(TypeConverter.ToObject(_realm, thisObject), 0); var aOperations = ArrayOperations.For(a); for (var i = 0; i < items.Count; i++) { @@ -1369,9 +1369,9 @@ private JsValue Concat(JsValue thisObj, JsValue[] arguments) return a; } - internal JsValue ToString(JsValue thisObj, JsValue[] arguments) + internal JsValue ToString(JsValue thisObject, JsValue[] arguments) { - var array = TypeConverter.ToObject(_realm, thisObj); + var array = TypeConverter.ToObject(_realm, thisObject); Func func; if (array.Get("join") is ICallable joinFunc) @@ -1386,9 +1386,9 @@ internal JsValue ToString(JsValue thisObj, JsValue[] arguments) return func(array, Arguments.Empty); } - private JsValue ToReversed(JsValue thisObj, JsValue[] arguments) + private JsValue ToReversed(JsValue thisObject, JsValue[] arguments) { - var o = ArrayOperations.For(TypeConverter.ToObject(_realm, thisObj)); + var o = ArrayOperations.For(TypeConverter.ToObject(_realm, thisObject)); var len = o.GetLongLength(); @@ -1407,9 +1407,9 @@ private JsValue ToReversed(JsValue thisObj, JsValue[] arguments) return new JsArray(_engine, a); } - private JsValue ToSorted(JsValue thisObj, JsValue[] arguments) + private JsValue ToSorted(JsValue thisObject, JsValue[] arguments) { - var o = ArrayOperations.For(TypeConverter.ToObject(_realm, thisObj)); + var o = ArrayOperations.For(TypeConverter.ToObject(_realm, thisObject)); var compareFn = GetCompareFunction(arguments.At(0)); var len = o.GetLongLength(); @@ -1427,12 +1427,12 @@ private JsValue ToSorted(JsValue thisObj, JsValue[] arguments) return new JsArray(_engine, array); } - private JsValue ToSpliced(JsValue thisObj, JsValue[] arguments) + private JsValue ToSpliced(JsValue thisObject, JsValue[] arguments) { var start = arguments.At(0); var deleteCount = arguments.At(1); - var o = ArrayOperations.For(_realm, TypeConverter.ToObject(_realm, thisObj)); + var o = ArrayOperations.For(_realm, TypeConverter.ToObject(_realm, thisObject)); var len = o.GetLongLength(); var relativeStart = TypeConverter.ToIntegerOrInfinity(start); @@ -1547,12 +1547,12 @@ private JsValue[] SortArray(IEnumerable array, ICallable? compareFn) /// /// https://tc39.es/ecma262/#sec-array.prototype.reduceright /// - private JsValue ReduceRight(JsValue thisObj, JsValue[] arguments) + private JsValue ReduceRight(JsValue thisObject, JsValue[] arguments) { var callbackfn = arguments.At(0); var initialValue = arguments.At(1); - var o = ArrayOperations.For(TypeConverter.ToObject(_realm, thisObj)); + var o = ArrayOperations.For(TypeConverter.ToObject(_realm, thisObject)); var len = o.GetLongLength(); var callable = GetCallable(callbackfn); diff --git a/Jint/Native/ArrayBuffer/ArrayBufferPrototype.cs b/Jint/Native/ArrayBuffer/ArrayBufferPrototype.cs index dcf9d8414c..ae7aab0533 100644 --- a/Jint/Native/ArrayBuffer/ArrayBufferPrototype.cs +++ b/Jint/Native/ArrayBuffer/ArrayBufferPrototype.cs @@ -42,12 +42,12 @@ protected override void Initialize() SetSymbols(symbols); } - private JsValue Detached(JsValue thisObj, JsValue[] arguments) + private JsValue Detached(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsArrayBuffer; + var o = thisObject as JsArrayBuffer; if (o is null) { - ExceptionHelper.ThrowTypeError(_realm, "Method ArrayBuffer.prototype.detached called on incompatible receiver " + thisObj); + ExceptionHelper.ThrowTypeError(_realm, "Method ArrayBuffer.prototype.detached called on incompatible receiver " + thisObject); } if (o.IsSharedArrayBuffer) @@ -61,12 +61,12 @@ private JsValue Detached(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-get-arraybuffer.prototype.bytelength /// - private JsValue ByteLength(JsValue thisObj, JsValue[] arguments) + private JsValue ByteLength(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsArrayBuffer; + var o = thisObject as JsArrayBuffer; if (o is null) { - ExceptionHelper.ThrowTypeError(_realm, "Method ArrayBuffer.prototype.byteLength called on incompatible receiver " + thisObj); + ExceptionHelper.ThrowTypeError(_realm, "Method ArrayBuffer.prototype.byteLength called on incompatible receiver " + thisObject); } if (o.IsSharedArrayBuffer) @@ -85,12 +85,12 @@ private JsValue ByteLength(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice /// - private JsValue Slice(JsValue thisObj, JsValue[] arguments) + private JsValue Slice(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsArrayBuffer; + var o = thisObject as JsArrayBuffer; if (o is null) { - ExceptionHelper.ThrowTypeError(_realm, "Method ArrayBuffer.prototype.slice called on incompatible receiver " + thisObj); + ExceptionHelper.ThrowTypeError(_realm, "Method ArrayBuffer.prototype.slice called on incompatible receiver " + thisObject); } if (o.IsSharedArrayBuffer) diff --git a/Jint/Native/BigInt/BigIntConstructor.cs b/Jint/Native/BigInt/BigIntConstructor.cs index 6bdb9a1ba5..d5971124b1 100644 --- a/Jint/Native/BigInt/BigIntConstructor.cs +++ b/Jint/Native/BigInt/BigIntConstructor.cs @@ -41,7 +41,7 @@ protected override void Initialize() /// /// https://tc39.es/ecma262/#sec-bigint.asintn /// - private JsValue AsIntN(JsValue thisObj, JsValue[] arguments) + private JsValue AsIntN(JsValue thisObject, JsValue[] arguments) { var bits = (int) TypeConverter.ToIndex(_realm, arguments.At(0)); var bigint = arguments.At(1).ToBigInteger(_engine); @@ -58,7 +58,7 @@ private JsValue AsIntN(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-bigint.asuintn /// - private JsValue AsUintN(JsValue thisObj, JsValue[] arguments) + private JsValue AsUintN(JsValue thisObject, JsValue[] arguments) { var bits = (int) TypeConverter.ToIndex(_realm, arguments.At(0)); var bigint = arguments.At(1).ToBigInteger(_engine); diff --git a/Jint/Native/BigInt/BigIntPrototype.cs b/Jint/Native/BigInt/BigIntPrototype.cs index b19d88a8ab..8d801fce9a 100644 --- a/Jint/Native/BigInt/BigIntPrototype.cs +++ b/Jint/Native/BigInt/BigIntPrototype.cs @@ -61,16 +61,16 @@ private JsValue ToLocaleString(JsValue thisObject, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-bigint.prototype.valueof /// - private JsValue ValueOf(JsValue thisObj, JsValue[] arguments) + private JsValue ValueOf(JsValue thisObject, JsValue[] arguments) { - if (thisObj is BigIntInstance ni) + if (thisObject is BigIntInstance ni) { return ni.BigIntData; } - if (thisObj is JsBigInt) + if (thisObject is JsBigInt) { - return thisObj; + return thisObject; } ExceptionHelper.ThrowTypeError(_realm); diff --git a/Jint/Native/Boolean/BooleanPrototype.cs b/Jint/Native/Boolean/BooleanPrototype.cs index f9be47db54..2379426429 100644 --- a/Jint/Native/Boolean/BooleanPrototype.cs +++ b/Jint/Native/Boolean/BooleanPrototype.cs @@ -36,14 +36,14 @@ protected override void Initialize() SetProperties(properties); } - private JsValue ValueOf(JsValue thisObj, JsValue[] arguments) + private JsValue ValueOf(JsValue thisObject, JsValue[] arguments) { - if (thisObj._type == InternalTypes.Boolean) + if (thisObject._type == InternalTypes.Boolean) { - return thisObj; + return thisObject; } - if (thisObj is BooleanInstance bi) + if (thisObject is BooleanInstance bi) { return bi.BooleanData; } @@ -52,9 +52,9 @@ private JsValue ValueOf(JsValue thisObj, JsValue[] arguments) return Undefined; } - private JsValue ToBooleanString(JsValue thisObj, JsValue[] arguments) + private JsValue ToBooleanString(JsValue thisObject, JsValue[] arguments) { - var b = ValueOf(thisObj, Arguments.Empty); + var b = ValueOf(thisObject, Arguments.Empty); return ((JsBoolean) b)._value ? JsString.TrueString : JsString.FalseString; } } diff --git a/Jint/Native/DataView/DataViewPrototype.cs b/Jint/Native/DataView/DataViewPrototype.cs index 1fcf80be47..304de07084 100644 --- a/Jint/Native/DataView/DataViewPrototype.cs +++ b/Jint/Native/DataView/DataViewPrototype.cs @@ -68,12 +68,12 @@ protected override void Initialize() /// /// https://tc39.es/ecma262/#sec-get-dataview.prototype.buffer /// - private JsValue Buffer(JsValue thisObj, JsValue[] arguments) + private JsValue Buffer(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsDataView; + var o = thisObject as JsDataView; if (o is null) { - ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.buffer called on incompatible receiver " + thisObj); + ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.buffer called on incompatible receiver " + thisObject); } return o._viewedArrayBuffer!; @@ -82,12 +82,12 @@ private JsValue Buffer(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-get-dataview.prototype.bytelength /// - private JsValue ByteLength(JsValue thisObj, JsValue[] arguments) + private JsValue ByteLength(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsDataView; + var o = thisObject as JsDataView; if (o is null) { - ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.byteLength called on incompatible receiver " + thisObj); + ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.byteLength called on incompatible receiver " + thisObject); } var buffer = o._viewedArrayBuffer!; @@ -99,12 +99,12 @@ private JsValue ByteLength(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-get-dataview.prototype.byteoffset /// - private JsValue ByteOffset(JsValue thisObj, JsValue[] arguments) + private JsValue ByteOffset(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsDataView; + var o = thisObject as JsDataView; if (o is null) { - ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.byteOffset called on incompatible receiver " + thisObj); + ExceptionHelper.ThrowTypeError(_realm, "Method get DataView.prototype.byteOffset called on incompatible receiver " + thisObject); } var buffer = o._viewedArrayBuffer!; @@ -113,104 +113,104 @@ private JsValue ByteOffset(JsValue thisObj, JsValue[] arguments) return JsNumber.Create(o._byteOffset); } - private JsValue GetBigInt64(JsValue thisObj, JsValue[] arguments) + private JsValue GetBigInt64(JsValue thisObject, JsValue[] arguments) { - return GetViewValue(thisObj, arguments.At(0), arguments.At(1), TypedArrayElementType.BigInt64); + return GetViewValue(thisObject, arguments.At(0), arguments.At(1), TypedArrayElementType.BigInt64); } - private JsValue GetBigUint64(JsValue thisObj, JsValue[] arguments) + private JsValue GetBigUint64(JsValue thisObject, JsValue[] arguments) { - return GetViewValue(thisObj, arguments.At(0), arguments.At(1), TypedArrayElementType.BigUint64); + return GetViewValue(thisObject, arguments.At(0), arguments.At(1), TypedArrayElementType.BigUint64); } - private JsValue GetFloat32(JsValue thisObj, JsValue[] arguments) + private JsValue GetFloat32(JsValue thisObject, JsValue[] arguments) { - return GetViewValue(thisObj, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Float32); + return GetViewValue(thisObject, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Float32); } - private JsValue GetFloat64(JsValue thisObj, JsValue[] arguments) + private JsValue GetFloat64(JsValue thisObject, JsValue[] arguments) { - return GetViewValue(thisObj, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Float64); + return GetViewValue(thisObject, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Float64); } - private JsValue GetInt8(JsValue thisObj, JsValue[] arguments) + private JsValue GetInt8(JsValue thisObject, JsValue[] arguments) { - return GetViewValue(thisObj, arguments.At(0), JsBoolean.True, TypedArrayElementType.Int8); + return GetViewValue(thisObject, arguments.At(0), JsBoolean.True, TypedArrayElementType.Int8); } - private JsValue GetInt16(JsValue thisObj, JsValue[] arguments) + private JsValue GetInt16(JsValue thisObject, JsValue[] arguments) { - return GetViewValue(thisObj, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Int16); + return GetViewValue(thisObject, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Int16); } - private JsValue GetInt32(JsValue thisObj, JsValue[] arguments) + private JsValue GetInt32(JsValue thisObject, JsValue[] arguments) { - return GetViewValue(thisObj, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Int32); + return GetViewValue(thisObject, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Int32); } - private JsValue GetUint8(JsValue thisObj, JsValue[] arguments) + private JsValue GetUint8(JsValue thisObject, JsValue[] arguments) { - return GetViewValue(thisObj, arguments.At(0), JsBoolean.True, TypedArrayElementType.Uint8); + return GetViewValue(thisObject, arguments.At(0), JsBoolean.True, TypedArrayElementType.Uint8); } - private JsValue GetUint16(JsValue thisObj, JsValue[] arguments) + private JsValue GetUint16(JsValue thisObject, JsValue[] arguments) { - return GetViewValue(thisObj, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Uint16); + return GetViewValue(thisObject, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Uint16); } - private JsValue GetUint32(JsValue thisObj, JsValue[] arguments) + private JsValue GetUint32(JsValue thisObject, JsValue[] arguments) { - return GetViewValue(thisObj, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Uint32); + return GetViewValue(thisObject, arguments.At(0), arguments.At(1, JsBoolean.False), TypedArrayElementType.Uint32); } - private JsValue SetBigInt64(JsValue thisObj, JsValue[] arguments) + private JsValue SetBigInt64(JsValue thisObject, JsValue[] arguments) { - return SetViewValue(thisObj, arguments.At(0), arguments.At(2), TypedArrayElementType.BigInt64, arguments.At(1)); + return SetViewValue(thisObject, arguments.At(0), arguments.At(2), TypedArrayElementType.BigInt64, arguments.At(1)); } - private JsValue SetBigUint64(JsValue thisObj, JsValue[] arguments) + private JsValue SetBigUint64(JsValue thisObject, JsValue[] arguments) { - return SetViewValue(thisObj, arguments.At(0), arguments.At(2), TypedArrayElementType.BigUint64, arguments.At(1)); + return SetViewValue(thisObject, arguments.At(0), arguments.At(2), TypedArrayElementType.BigUint64, arguments.At(1)); } - private JsValue SetFloat32 (JsValue thisObj, JsValue[] arguments) + private JsValue SetFloat32 (JsValue thisObject, JsValue[] arguments) { - return SetViewValue(thisObj, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Float32, arguments.At(1)); + return SetViewValue(thisObject, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Float32, arguments.At(1)); } - private JsValue SetFloat64(JsValue thisObj, JsValue[] arguments) + private JsValue SetFloat64(JsValue thisObject, JsValue[] arguments) { - return SetViewValue(thisObj, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Float64, arguments.At(1)); + return SetViewValue(thisObject, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Float64, arguments.At(1)); } - private JsValue SetInt8 (JsValue thisObj, JsValue[] arguments) + private JsValue SetInt8 (JsValue thisObject, JsValue[] arguments) { - return SetViewValue(thisObj, arguments.At(0), JsBoolean.True, TypedArrayElementType.Int8, arguments.At(1)); + return SetViewValue(thisObject, arguments.At(0), JsBoolean.True, TypedArrayElementType.Int8, arguments.At(1)); } - private JsValue SetInt16(JsValue thisObj, JsValue[] arguments) + private JsValue SetInt16(JsValue thisObject, JsValue[] arguments) { - return SetViewValue(thisObj, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Int16, arguments.At(1)); + return SetViewValue(thisObject, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Int16, arguments.At(1)); } - private JsValue SetInt32(JsValue thisObj, JsValue[] arguments) + private JsValue SetInt32(JsValue thisObject, JsValue[] arguments) { - return SetViewValue(thisObj, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Int32, arguments.At(1)); + return SetViewValue(thisObject, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Int32, arguments.At(1)); } - private JsValue SetUint8(JsValue thisObj, JsValue[] arguments) + private JsValue SetUint8(JsValue thisObject, JsValue[] arguments) { - return SetViewValue(thisObj, arguments.At(0), JsBoolean.True, TypedArrayElementType.Uint8, arguments.At(1)); + return SetViewValue(thisObject, arguments.At(0), JsBoolean.True, TypedArrayElementType.Uint8, arguments.At(1)); } - private JsValue SetUint16(JsValue thisObj, JsValue[] arguments) + private JsValue SetUint16(JsValue thisObject, JsValue[] arguments) { - return SetViewValue(thisObj, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Uint16, arguments.At(1)); + return SetViewValue(thisObject, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Uint16, arguments.At(1)); } - private JsValue SetUint32(JsValue thisObj, JsValue[] arguments) + private JsValue SetUint32(JsValue thisObject, JsValue[] arguments) { - return SetViewValue(thisObj, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Uint32, arguments.At(1)); + return SetViewValue(thisObject, arguments.At(0), arguments.At(2, JsBoolean.False), TypedArrayElementType.Uint32, arguments.At(1)); } /// diff --git a/Jint/Native/Date/DateConstructor.cs b/Jint/Native/Date/DateConstructor.cs index f900c7b3d8..144162d420 100644 --- a/Jint/Native/Date/DateConstructor.cs +++ b/Jint/Native/Date/DateConstructor.cs @@ -49,7 +49,7 @@ protected override void Initialize() /// /// https://tc39.es/ecma262/#sec-date.parse /// - private JsValue Parse(JsValue thisObj, JsValue[] arguments) + private JsValue Parse(JsValue thisObject, JsValue[] arguments) { var dateString = TypeConverter.ToString(arguments.At(0)); var date = ParseFromString(dateString); @@ -73,7 +73,7 @@ private DatePresentation ParseFromString(string date) /// /// https://tc39.es/ecma262/#sec-date.utc /// - private static JsValue Utc(JsValue thisObj, JsValue[] arguments) + private static JsValue Utc(JsValue thisObject, JsValue[] arguments) { var y = TypeConverter.ToNumber(arguments.At(0)); var m = TypeConverter.ToNumber(arguments.At(1, JsNumber.PositiveZero)); @@ -96,7 +96,7 @@ private static JsValue Utc(JsValue thisObj, JsValue[] arguments) return finalDate.TimeClip().ToJsValue(); } - private static JsValue Now(JsValue thisObj, JsValue[] arguments) + private static JsValue Now(JsValue thisObject, JsValue[] arguments) { return (long) (DateTime.UtcNow - Epoch).TotalMilliseconds; } diff --git a/Jint/Native/Date/DatePrototype.cs b/Jint/Native/Date/DatePrototype.cs index a557f66faf..16796707d9 100644 --- a/Jint/Native/Date/DatePrototype.cs +++ b/Jint/Native/Date/DatePrototype.cs @@ -131,17 +131,17 @@ private JsValue ToPrimitive(JsValue thisObject, JsValue[] arguments) return TypeConverter.OrdinaryToPrimitive(oi, tryFirst); } - private JsValue ValueOf(JsValue thisObj, JsValue[] arguments) + private JsValue ValueOf(JsValue thisObject, JsValue[] arguments) { - return ThisTimeValue(thisObj).ToJsValue(); + return ThisTimeValue(thisObject).ToJsValue(); } /// /// https://tc39.es/ecma262/#thistimevalue /// - private DatePresentation ThisTimeValue(JsValue thisObj) + private DatePresentation ThisTimeValue(JsValue thisObject) { - if (thisObj is JsDate dateInstance) + if (thisObject is JsDate dateInstance) { return dateInstance._dateValue; } @@ -153,18 +153,18 @@ private DatePresentation ThisTimeValue(JsValue thisObj) /// /// https://tc39.es/ecma262/#sec-date.prototype.tostring /// - internal JsValue ToString(JsValue thisObj, JsValue[] arg2) + internal JsValue ToString(JsValue thisObject, JsValue[] arg2) { - var tv = ThisTimeValue(thisObj); + var tv = ThisTimeValue(thisObject); return ToDateString(tv); } /// /// https://tc39.es/ecma262/#sec-date.prototype.todatestring /// - private JsValue ToDateString(JsValue thisObj, JsValue[] arguments) + private JsValue ToDateString(JsValue thisObject, JsValue[] arguments) { - var tv = ThisTimeValue(thisObj); + var tv = ThisTimeValue(thisObject); if (tv.IsNaN) { @@ -192,9 +192,9 @@ private JsValue ToDateString(DatePresentation tv) /// /// https://tc39.es/ecma262/#sec-date.prototype.totimestring /// - private JsValue ToTimeString(JsValue thisObj, JsValue[] arguments) + private JsValue ToTimeString(JsValue thisObject, JsValue[] arguments) { - var tv = ThisTimeValue(thisObj); + var tv = ThisTimeValue(thisObject); if (tv.IsNaN) { @@ -209,9 +209,9 @@ private JsValue ToTimeString(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-date.prototype.tolocalestring /// - private JsValue ToLocaleString(JsValue thisObj, JsValue[] arguments) + private JsValue ToLocaleString(JsValue thisObject, JsValue[] arguments) { - var dateInstance = ThisTimeValue(thisObj); + var dateInstance = ThisTimeValue(thisObject); if (dateInstance.IsNaN) { @@ -224,9 +224,9 @@ private JsValue ToLocaleString(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-date.prototype.tolocaledatestring /// - private JsValue ToLocaleDateString(JsValue thisObj, JsValue[] arguments) + private JsValue ToLocaleDateString(JsValue thisObject, JsValue[] arguments) { - var dateInstance = ThisTimeValue(thisObj); + var dateInstance = ThisTimeValue(thisObject); if (dateInstance.IsNaN) { @@ -239,9 +239,9 @@ private JsValue ToLocaleDateString(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-date.prototype.tolocaletimestring /// - private JsValue ToLocaleTimeString(JsValue thisObj, JsValue[] arguments) + private JsValue ToLocaleTimeString(JsValue thisObject, JsValue[] arguments) { - var dateInstance = ThisTimeValue(thisObj); + var dateInstance = ThisTimeValue(thisObject); if (dateInstance.IsNaN) { @@ -251,9 +251,9 @@ private JsValue ToLocaleTimeString(JsValue thisObj, JsValue[] arguments) return ToLocalTime(dateInstance).ToString("T", Engine.Options.Culture); } - private JsValue GetTime(JsValue thisObj, JsValue[] arguments) + private JsValue GetTime(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -261,9 +261,9 @@ private JsValue GetTime(JsValue thisObj, JsValue[] arguments) return t.ToJsValue(); } - private JsValue GetFullYear(JsValue thisObj, JsValue[] arguments) + private JsValue GetFullYear(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -271,9 +271,9 @@ private JsValue GetFullYear(JsValue thisObj, JsValue[] arguments) return YearFromTime(LocalTime(t)); } - private JsValue GetYear(JsValue thisObj, JsValue[] arguments) + private JsValue GetYear(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -281,9 +281,9 @@ private JsValue GetYear(JsValue thisObj, JsValue[] arguments) return YearFromTime(LocalTime(t)) - 1900; } - private JsValue GetUTCFullYear(JsValue thisObj, JsValue[] arguments) + private JsValue GetUTCFullYear(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -291,9 +291,9 @@ private JsValue GetUTCFullYear(JsValue thisObj, JsValue[] arguments) return YearFromTime(t); } - private JsValue GetMonth(JsValue thisObj, JsValue[] arguments) + private JsValue GetMonth(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -304,9 +304,9 @@ private JsValue GetMonth(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-date.prototype.getutcmonth /// - private JsValue GetUTCMonth(JsValue thisObj, JsValue[] arguments) + private JsValue GetUTCMonth(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -317,9 +317,9 @@ private JsValue GetUTCMonth(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-date.prototype.getdate /// - private JsValue GetDate(JsValue thisObj, JsValue[] arguments) + private JsValue GetDate(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -327,9 +327,9 @@ private JsValue GetDate(JsValue thisObj, JsValue[] arguments) return DateFromTime(LocalTime(t)); } - private JsValue GetUTCDate(JsValue thisObj, JsValue[] arguments) + private JsValue GetUTCDate(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -337,9 +337,9 @@ private JsValue GetUTCDate(JsValue thisObj, JsValue[] arguments) return DateFromTime(t); } - private JsValue GetDay(JsValue thisObj, JsValue[] arguments) + private JsValue GetDay(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -347,9 +347,9 @@ private JsValue GetDay(JsValue thisObj, JsValue[] arguments) return WeekDay(LocalTime(t)); } - private JsValue GetUTCDay(JsValue thisObj, JsValue[] arguments) + private JsValue GetUTCDay(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -357,9 +357,9 @@ private JsValue GetUTCDay(JsValue thisObj, JsValue[] arguments) return WeekDay(t); } - private JsValue GetHours(JsValue thisObj, JsValue[] arguments) + private JsValue GetHours(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -367,9 +367,9 @@ private JsValue GetHours(JsValue thisObj, JsValue[] arguments) return HourFromTime(LocalTime(t)); } - private JsValue GetUTCHours(JsValue thisObj, JsValue[] arguments) + private JsValue GetUTCHours(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -377,9 +377,9 @@ private JsValue GetUTCHours(JsValue thisObj, JsValue[] arguments) return HourFromTime(t); } - private JsValue GetMinutes(JsValue thisObj, JsValue[] arguments) + private JsValue GetMinutes(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -387,9 +387,9 @@ private JsValue GetMinutes(JsValue thisObj, JsValue[] arguments) return MinFromTime(LocalTime(t)); } - private JsValue GetUTCMinutes(JsValue thisObj, JsValue[] arguments) + private JsValue GetUTCMinutes(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -397,9 +397,9 @@ private JsValue GetUTCMinutes(JsValue thisObj, JsValue[] arguments) return MinFromTime(t); } - private JsValue GetSeconds(JsValue thisObj, JsValue[] arguments) + private JsValue GetSeconds(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -407,9 +407,9 @@ private JsValue GetSeconds(JsValue thisObj, JsValue[] arguments) return SecFromTime(LocalTime(t)); } - private JsValue GetUTCSeconds(JsValue thisObj, JsValue[] arguments) + private JsValue GetUTCSeconds(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -417,9 +417,9 @@ private JsValue GetUTCSeconds(JsValue thisObj, JsValue[] arguments) return SecFromTime(t); } - private JsValue GetMilliseconds(JsValue thisObj, JsValue[] arguments) + private JsValue GetMilliseconds(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -427,9 +427,9 @@ private JsValue GetMilliseconds(JsValue thisObj, JsValue[] arguments) return MsFromTime(LocalTime(t)); } - private JsValue GetUTCMilliseconds(JsValue thisObj, JsValue[] arguments) + private JsValue GetUTCMilliseconds(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -437,9 +437,9 @@ private JsValue GetUTCMilliseconds(JsValue thisObj, JsValue[] arguments) return MsFromTime(t); } - private JsValue GetTimezoneOffset(JsValue thisObj, JsValue[] arguments) + private JsValue GetTimezoneOffset(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); if (t.IsNaN) { return JsNumber.DoubleNaN; @@ -450,22 +450,22 @@ private JsValue GetTimezoneOffset(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-date.prototype.settime /// - private JsValue SetTime(JsValue thisObj, JsValue[] arguments) + private JsValue SetTime(JsValue thisObject, JsValue[] arguments) { - ThisTimeValue(thisObj); + ThisTimeValue(thisObject); var t = TypeConverter.ToNumber(arguments.At(0)); var v = t.TimeClip(); - ((JsDate) thisObj)._dateValue = t; + ((JsDate) thisObject)._dateValue = t; return v.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setmilliseconds /// - private JsValue SetMilliseconds(JsValue thisObj, JsValue[] arguments) + private JsValue SetMilliseconds(JsValue thisObject, JsValue[] arguments) { - var t = LocalTime(ThisTimeValue(thisObj)); + var t = LocalTime(ThisTimeValue(thisObject)); var ms = TypeConverter.ToNumber(arguments.At(0)); if (t.IsNaN) @@ -475,16 +475,16 @@ private JsValue SetMilliseconds(JsValue thisObj, JsValue[] arguments) var time = MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), ms); var u = Utc(MakeDate(Day(t), time)).TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setutcmilliseconds /// - private JsValue SetUTCMilliseconds(JsValue thisObj, JsValue[] arguments) + private JsValue SetUTCMilliseconds(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); var milli = TypeConverter.ToNumber(arguments.At(0)); if (t.IsNaN) @@ -494,16 +494,16 @@ private JsValue SetUTCMilliseconds(JsValue thisObj, JsValue[] arguments) var time = MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), milli); var u = MakeDate(Day(t), time).TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setseconds /// - private JsValue SetSeconds(JsValue thisObj, JsValue[] arguments) + private JsValue SetSeconds(JsValue thisObject, JsValue[] arguments) { - var t = LocalTime(ThisTimeValue(thisObj)); + var t = LocalTime(ThisTimeValue(thisObject)); var s = TypeConverter.ToNumber(arguments.At(0)); var milli = arguments.Length <= 1 ? MsFromTime(t) : TypeConverter.ToNumber(arguments.At(1)); @@ -514,16 +514,16 @@ private JsValue SetSeconds(JsValue thisObj, JsValue[] arguments) var date = MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, milli)); var u = Utc(date).TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setutcseconds /// - private JsValue SetUTCSeconds(JsValue thisObj, JsValue[] arguments) + private JsValue SetUTCSeconds(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); var s = TypeConverter.ToNumber(arguments.At(0)); var milli = arguments.Length <= 1 ? MsFromTime(t) : TypeConverter.ToNumber(arguments.At(1)); @@ -534,16 +534,16 @@ private JsValue SetUTCSeconds(JsValue thisObj, JsValue[] arguments) var date = MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, milli)); var u = date.TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setminutes /// - private JsValue SetMinutes(JsValue thisObj, JsValue[] arguments) + private JsValue SetMinutes(JsValue thisObject, JsValue[] arguments) { - var t = LocalTime(ThisTimeValue(thisObj)); + var t = LocalTime(ThisTimeValue(thisObject)); var m = TypeConverter.ToNumber(arguments.At(0)); var s = arguments.Length <= 1 ? SecFromTime(t) : TypeConverter.ToNumber(arguments.At(1)); var milli = arguments.Length <= 2 ? MsFromTime(t) : TypeConverter.ToNumber(arguments.At(2)); @@ -555,16 +555,16 @@ private JsValue SetMinutes(JsValue thisObj, JsValue[] arguments) var date = MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli)); var u = Utc(date).TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setutcminutes /// - private JsValue SetUTCMinutes(JsValue thisObj, JsValue[] arguments) + private JsValue SetUTCMinutes(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); var m = TypeConverter.ToNumber(arguments.At(0)); var s = arguments.Length <= 1 ? SecFromTime(t) : TypeConverter.ToNumber(arguments.At(1)); var milli = arguments.Length <= 2 ? MsFromTime(t) : TypeConverter.ToNumber(arguments.At(2)); @@ -576,16 +576,16 @@ private JsValue SetUTCMinutes(JsValue thisObj, JsValue[] arguments) var date = MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli)); var u = date.TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.sethours /// - private JsValue SetHours(JsValue thisObj, JsValue[] arguments) + private JsValue SetHours(JsValue thisObject, JsValue[] arguments) { - var t = LocalTime(ThisTimeValue(thisObj)); + var t = LocalTime(ThisTimeValue(thisObject)); var h = TypeConverter.ToNumber(arguments.At(0)); var m = arguments.Length <= 1 ? MinFromTime(t) : TypeConverter.ToNumber(arguments.At(1)); var s = arguments.Length <= 2 ? SecFromTime(t) : TypeConverter.ToNumber(arguments.At(2)); @@ -598,16 +598,16 @@ private JsValue SetHours(JsValue thisObj, JsValue[] arguments) var date = MakeDate(Day(t), MakeTime(h, m, s, milli)); var u = Utc(date).TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setutchours /// - private JsValue SetUTCHours(JsValue thisObj, JsValue[] arguments) + private JsValue SetUTCHours(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); var h = TypeConverter.ToNumber(arguments.At(0)); var m = arguments.Length <= 1 ? MinFromTime(t) : TypeConverter.ToNumber(arguments.At(1)); var s = arguments.Length <= 2 ? SecFromTime(t) : TypeConverter.ToNumber(arguments.At(2)); @@ -620,16 +620,16 @@ private JsValue SetUTCHours(JsValue thisObj, JsValue[] arguments) var newDate = MakeDate(Day(t), MakeTime(h, m, s, milli)); var v = newDate.TimeClip(); - ((JsDate) thisObj)._dateValue = v; + ((JsDate) thisObject)._dateValue = v; return v.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setdate /// - private JsValue SetDate(JsValue thisObj, JsValue[] arguments) + private JsValue SetDate(JsValue thisObject, JsValue[] arguments) { - var t = LocalTime(ThisTimeValue(thisObj)); + var t = LocalTime(ThisTimeValue(thisObject)); var dt = TypeConverter.ToNumber(arguments.At(0)); if (t.IsNaN) @@ -640,16 +640,16 @@ private JsValue SetDate(JsValue thisObj, JsValue[] arguments) var (year, month, __) = YearMonthDayFromTime(t); var newDate = MakeDate(MakeDay(year, month, dt), TimeWithinDay(t)); var u = Utc(newDate).TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setutcdate /// - private JsValue SetUTCDate(JsValue thisObj, JsValue[] arguments) + private JsValue SetUTCDate(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); var dt = TypeConverter.ToNumber(arguments.At(0)); if (t.IsNaN) @@ -659,16 +659,16 @@ private JsValue SetUTCDate(JsValue thisObj, JsValue[] arguments) var newDate = MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), TimeWithinDay(t)); var u = newDate.TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setmonth /// - private JsValue SetMonth(JsValue thisObj, JsValue[] arguments) + private JsValue SetMonth(JsValue thisObject, JsValue[] arguments) { - var t = LocalTime(ThisTimeValue(thisObj)); + var t = LocalTime(ThisTimeValue(thisObject)); var m = TypeConverter.ToNumber(arguments.At(0)); var dt = arguments.Length <= 1 ? DateFromTime(t) : TypeConverter.ToNumber(arguments.At(1)); @@ -679,16 +679,16 @@ private JsValue SetMonth(JsValue thisObj, JsValue[] arguments) var newDate = MakeDate(MakeDay(YearFromTime(t), m, dt), TimeWithinDay(t)); var u = Utc(newDate).TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setutcmonth /// - private JsValue SetUTCMonth(JsValue thisObj, JsValue[] arguments) + private JsValue SetUTCMonth(JsValue thisObject, JsValue[] arguments) { - var t = ThisTimeValue(thisObj); + var t = ThisTimeValue(thisObject); var m = TypeConverter.ToNumber(arguments.At(0)); var dt = arguments.Length <= 1 ? DateFromTime(t) : TypeConverter.ToNumber(arguments.At(1)); @@ -699,16 +699,16 @@ private JsValue SetUTCMonth(JsValue thisObj, JsValue[] arguments) var newDate = MakeDate(MakeDay(YearFromTime(t), m, dt), TimeWithinDay(t)); var u = newDate.TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setfullyear /// - private JsValue SetFullYear(JsValue thisObj, JsValue[] arguments) + private JsValue SetFullYear(JsValue thisObject, JsValue[] arguments) { - var thisTime = ThisTimeValue(thisObj); + var thisTime = ThisTimeValue(thisObject); var t = thisTime.IsNaN ? 0 : LocalTime(thisTime); var y = TypeConverter.ToNumber(arguments.At(0)); var m = arguments.Length <= 1 ? MonthFromTime(t) : TypeConverter.ToNumber(arguments.At(1)); @@ -716,21 +716,21 @@ private JsValue SetFullYear(JsValue thisObj, JsValue[] arguments) var newDate = MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)); var u = Utc(newDate).TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setyear /// - private JsValue SetYear(JsValue thisObj, JsValue[] arguments) + private JsValue SetYear(JsValue thisObject, JsValue[] arguments) { - var thisTime = ThisTimeValue(thisObj); + var thisTime = ThisTimeValue(thisObject); var t = thisTime.IsNaN ? 0 : LocalTime(thisTime); var y = TypeConverter.ToNumber(arguments.At(0)); if (double.IsNaN(y)) { - ((JsDate) thisObj)._dateValue = double.NaN; + ((JsDate) thisObject)._dateValue = double.NaN; return JsNumber.DoubleNaN; } @@ -742,32 +742,32 @@ private JsValue SetYear(JsValue thisObj, JsValue[] arguments) var newDate = MakeDay(fy, MonthFromTime(t), DateFromTime(t)); var u = Utc(MakeDate(newDate, TimeWithinDay(t))); - ((JsDate) thisObj)._dateValue = u.TimeClip(); + ((JsDate) thisObject)._dateValue = u.TimeClip(); return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.setutcfullyear /// - private JsValue SetUTCFullYear(JsValue thisObj, JsValue[] arguments) + private JsValue SetUTCFullYear(JsValue thisObject, JsValue[] arguments) { - var thisTime = ThisTimeValue(thisObj); + var thisTime = ThisTimeValue(thisObject); var t = thisTime.IsNaN ? 0 : thisTime; var y = TypeConverter.ToNumber(arguments.At(0)); var m = arguments.Length <= 1 ? MonthFromTime(t) : TypeConverter.ToNumber(arguments.At(1)); var dt = arguments.Length <= 2 ? DateFromTime(t) : TypeConverter.ToNumber(arguments.At(2)); var newDate = MakeDate(MakeDay(y, m, dt), TimeWithinDay(t)); var u = newDate.TimeClip(); - ((JsDate) thisObj)._dateValue = u; + ((JsDate) thisObject)._dateValue = u; return u.ToJsValue(); } /// /// https://tc39.es/ecma262/#sec-date.prototype.toutcstring /// - private JsValue ToUtcString(JsValue thisObj, JsValue[] arguments) + private JsValue ToUtcString(JsValue thisObject, JsValue[] arguments) { - var tv = ThisTimeValue(thisObj); + var tv = ThisTimeValue(thisObject); if (!IsFinite(tv)) { return "Invalid Date"; @@ -785,16 +785,16 @@ private JsValue ToUtcString(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-date.prototype.toisostring /// - private JsValue ToISOString(JsValue thisObj, JsValue[] arguments) + private JsValue ToISOString(JsValue thisObject, JsValue[] arguments) { - var thisTime = ThisTimeValue(thisObj); + var thisTime = ThisTimeValue(thisObject); var t = thisTime; if (t.IsNaN) { ExceptionHelper.ThrowRangeError(_realm); } - if (((JsDate) thisObj).DateTimeRangeValid) + if (((JsDate) thisObject).DateTimeRangeValid) { // shortcut var dt = thisTime.ToDateTime(); @@ -822,9 +822,9 @@ private JsValue ToISOString(JsValue thisObj, JsValue[] arguments) return formatted; } - private JsValue ToJson(JsValue thisObj, JsValue[] arguments) + private JsValue ToJson(JsValue thisObject, JsValue[] arguments) { - var o = TypeConverter.ToObject(_realm, thisObj); + var o = TypeConverter.ToObject(_realm, thisObject); var tv = TypeConverter.ToPrimitive(o, Types.Number); if (tv.IsNumber() && !IsFinite(((JsNumber) tv)._value)) { diff --git a/Jint/Native/FinalizationRegistry/FinalizationRegistryPrototype.cs b/Jint/Native/FinalizationRegistry/FinalizationRegistryPrototype.cs index bf9918220a..0f39c5e6dd 100644 --- a/Jint/Native/FinalizationRegistry/FinalizationRegistryPrototype.cs +++ b/Jint/Native/FinalizationRegistry/FinalizationRegistryPrototype.cs @@ -29,10 +29,7 @@ protected override void Initialize() const PropertyFlag PropertyFlags = PropertyFlag.NonEnumerable; var properties = new PropertyDictionary(4, checkExistingKeys: false) { - [KnownKeys.Constructor] = new(_constructor, PropertyFlag.NonEnumerable), - ["register"] = new(new ClrFunctionInstance(Engine, "register", Register, 2, PropertyFlag.Configurable), PropertyFlags), - ["unregister"] = new(new ClrFunctionInstance(Engine, "unregister", Unregister, 1, PropertyFlag.Configurable), PropertyFlags), - ["cleanupSome"] = new(new ClrFunctionInstance(Engine, "cleanupSome", CleanupSome, 0, PropertyFlag.Configurable), PropertyFlags), + [KnownKeys.Constructor] = new(_constructor, PropertyFlag.NonEnumerable), ["register"] = new(new ClrFunctionInstance(Engine, "register", Register, 2, PropertyFlag.Configurable), PropertyFlags), ["unregister"] = new(new ClrFunctionInstance(Engine, "unregister", Unregister, 1, PropertyFlag.Configurable), PropertyFlags), ["cleanupSome"] = new(new ClrFunctionInstance(Engine, "cleanupSome", CleanupSome, 0, PropertyFlag.Configurable), PropertyFlags), }; SetProperties(properties); @@ -43,9 +40,9 @@ protected override void Initialize() /// /// https://tc39.es/ecma262/#sec-finalization-registry.prototype.register /// - private JsValue Register(JsValue thisObj, JsValue[] arguments) + private JsValue Register(JsValue thisObject, JsValue[] arguments) { - var finalizationRegistry = AssertFinalizationRegistryInstance(thisObj); + var finalizationRegistry = AssertFinalizationRegistryInstance(thisObject); var target = arguments.At(0); var heldValue = arguments.At(1); @@ -67,8 +64,8 @@ private JsValue Register(JsValue thisObj, JsValue[] arguments) { ExceptionHelper.ThrowTypeError(_realm, unregisterToken + " must be an object"); } - } + var cell = new Cell(target, heldValue, unregisterToken); finalizationRegistry.AddCell(cell); return Undefined; @@ -77,9 +74,9 @@ private JsValue Register(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-finalization-registry.prototype.unregister /// - private JsValue Unregister(JsValue thisObj, JsValue[] arguments) + private JsValue Unregister(JsValue thisObject, JsValue[] arguments) { - var finalizationRegistry = AssertFinalizationRegistryInstance(thisObj); + var finalizationRegistry = AssertFinalizationRegistryInstance(thisObject); var unregisterToken = arguments.At(0); @@ -91,9 +88,9 @@ private JsValue Unregister(JsValue thisObj, JsValue[] arguments) return finalizationRegistry.Remove(unregisterToken); } - private JsValue CleanupSome(JsValue thisObj, JsValue[] arguments) + private JsValue CleanupSome(JsValue thisObject, JsValue[] arguments) { - var finalizationRegistry = AssertFinalizationRegistryInstance(thisObj); + var finalizationRegistry = AssertFinalizationRegistryInstance(thisObject); var callback = arguments.At(0); if (!callback.IsUndefined() && callback is not ICallable) @@ -106,15 +103,14 @@ private JsValue CleanupSome(JsValue thisObj, JsValue[] arguments) return Undefined; } - private FinalizationRegistryInstance AssertFinalizationRegistryInstance(JsValue thisObj) + private FinalizationRegistryInstance AssertFinalizationRegistryInstance(JsValue thisObject) { - if (thisObj is not FinalizationRegistryInstance finalizationRegistryInstance) + if (thisObject is FinalizationRegistryInstance finalizationRegistryInstance) { - ExceptionHelper.ThrowTypeError(_realm, "object must be a FinalizationRegistry"); - return null; + return finalizationRegistryInstance; } - return finalizationRegistryInstance; + ExceptionHelper.ThrowTypeError(_realm, "object must be a FinalizationRegistry"); + return default; } } - diff --git a/Jint/Native/Function/FunctionInstance.Dynamic.cs b/Jint/Native/Function/FunctionInstance.Dynamic.cs index 162428b981..b3537b833c 100644 --- a/Jint/Native/Function/FunctionInstance.Dynamic.cs +++ b/Jint/Native/Function/FunctionInstance.Dynamic.cs @@ -18,7 +18,7 @@ internal FunctionInstance CreateDynamicFunction( ObjectInstance constructor, JsValue newTarget, FunctionKind kind, - JsValue[] args) + JsValue[] arguments) { // TODO var callerContext = _engine.GetExecutionContext(1); var callerContext = _engine.ExecutionContext; @@ -48,25 +48,25 @@ internal FunctionInstance CreateDynamicFunction( break; } - var argCount = args.Length; + var argCount = arguments.Length; var p = ""; var body = ""; if (argCount == 1) { - body = TypeConverter.ToString(args[0]); + body = TypeConverter.ToString(arguments[0]); } else if (argCount > 1) { - var firstArg = args[0]; + var firstArg = arguments[0]; p = TypeConverter.ToString(firstArg); for (var k = 1; k < argCount - 1; k++) { - var nextArg = args[k]; + var nextArg = arguments[k]; p += "," + TypeConverter.ToString(nextArg); } - body = TypeConverter.ToString(args[argCount - 1]); + body = TypeConverter.ToString(arguments[argCount - 1]); } IFunction? function = null; diff --git a/Jint/Native/Function/FunctionPrototype.cs b/Jint/Native/Function/FunctionPrototype.cs index 193f93fd8d..7ea20ac7e5 100644 --- a/Jint/Native/Function/FunctionPrototype.cs +++ b/Jint/Native/Function/FunctionPrototype.cs @@ -49,17 +49,17 @@ protected override void Initialize() /// /// https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance /// - private static JsValue HasInstance(JsValue thisObj, JsValue[] arguments) + private static JsValue HasInstance(JsValue thisObject, JsValue[] arguments) { - return thisObj.OrdinaryHasInstance(arguments.At(0)); + return thisObject.OrdinaryHasInstance(arguments.At(0)); } /// /// https://tc39.es/ecma262/#sec-function.prototype.bind /// - private JsValue Bind(JsValue thisObj, JsValue[] arguments) + private JsValue Bind(JsValue thisObject, JsValue[] arguments) { - if (thisObj is not (ICallable and ObjectInstance oi)) + if (thisObject is not (ICallable and ObjectInstance oi)) { ExceptionHelper.ThrowTypeError(_realm, "Bind must be called on a function"); return default; @@ -127,11 +127,11 @@ private BindFunctionInstance BoundFunctionCreate(ObjectInstance targetFunction, /// /// https://tc39.es/ecma262/#sec-function.prototype.tostring /// - private JsValue ToString(JsValue thisObj, JsValue[] arguments) + private JsValue ToString(JsValue thisObject, JsValue[] arguments) { - if (thisObj.IsObject() && thisObj.IsCallable) + if (thisObject.IsObject() && thisObject.IsCallable) { - return thisObj.ToString(); + return thisObject.ToString(); } ExceptionHelper.ThrowTypeError(_realm, "Function.prototype.toString requires that 'this' be a Function"); diff --git a/Jint/Native/Global/GlobalObject.cs b/Jint/Native/Global/GlobalObject.cs index dc8ae33c1f..5390fc0e05 100644 --- a/Jint/Native/Global/GlobalObject.cs +++ b/Jint/Native/Global/GlobalObject.cs @@ -132,9 +132,9 @@ protected override void Initialize() SetProperties(properties); } - private JsValue ToStringString(JsValue thisObj, JsValue[] arguments) + private JsValue ToStringString(JsValue thisObject, JsValue[] arguments) { - return _realm.Intrinsics.Object.PrototypeObject.ToObjectString(thisObj, Arguments.Empty); + return _realm.Intrinsics.Object.PrototypeObject.ToObjectString(thisObject, Arguments.Empty); } /// diff --git a/Jint/Native/GroupByHelper.cs b/Jint/Native/GroupByHelper.cs index 252e82132b..78289b388a 100644 --- a/Jint/Native/GroupByHelper.cs +++ b/Jint/Native/GroupByHelper.cs @@ -42,7 +42,7 @@ public GroupByProtocol( _mapMode = mapMode; } - protected override void ProcessItem(JsValue[] args, JsValue currentValue) + protected override void ProcessItem(JsValue[] arguments, JsValue currentValue) { if (_k >= ArrayOperations.MaxArrayLength) { diff --git a/Jint/Native/Iterator/IteratorProtocol.cs b/Jint/Native/Iterator/IteratorProtocol.cs index 0848cdf846..73218d2675 100644 --- a/Jint/Native/Iterator/IteratorProtocol.cs +++ b/Jint/Native/Iterator/IteratorProtocol.cs @@ -66,7 +66,7 @@ protected virtual void IterationEnd() { } - protected abstract void ProcessItem(JsValue[] args, JsValue currentValue); + protected abstract void ProcessItem(JsValue[] arguments, JsValue currentValue); internal static void AddEntriesFromIterable(ObjectInstance target, IteratorInstance iterable, object adder) { diff --git a/Jint/Native/Iterator/IteratorPrototype.cs b/Jint/Native/Iterator/IteratorPrototype.cs index de1b23959e..4a98e177eb 100644 --- a/Jint/Native/Iterator/IteratorPrototype.cs +++ b/Jint/Native/Iterator/IteratorPrototype.cs @@ -28,14 +28,14 @@ protected override void Initialize() SetSymbols(symbols); } - private static JsValue ToIterator(JsValue thisObj, JsValue[] arguments) + private static JsValue ToIterator(JsValue thisObject, JsValue[] arguments) { - return thisObj; + return thisObject; } - internal JsValue Next(JsValue thisObj, JsValue[] arguments) + internal JsValue Next(JsValue thisObject, JsValue[] arguments) { - var iterator = thisObj as IteratorInstance; + var iterator = thisObject as IteratorInstance; if (iterator is null) { ExceptionHelper.ThrowTypeError(_engine.Realm); diff --git a/Jint/Native/Map/MapPrototype.cs b/Jint/Native/Map/MapPrototype.cs index b06cb317c2..f0726243cd 100644 --- a/Jint/Native/Map/MapPrototype.cs +++ b/Jint/Native/Map/MapPrototype.cs @@ -52,51 +52,51 @@ protected override void Initialize() SetSymbols(symbols); } - private JsValue Size(JsValue thisObj, JsValue[] arguments) + private JsValue Size(JsValue thisObject, JsValue[] arguments) { - AssertMapInstance(thisObj); + AssertMapInstance(thisObject); return JsNumber.Create(0); } - private JsValue Get(JsValue thisObj, JsValue[] arguments) + private JsValue Get(JsValue thisObject, JsValue[] arguments) { - var map = AssertMapInstance(thisObj); + var map = AssertMapInstance(thisObject); return map.MapGet(arguments.At(0)); } - private JsValue Clear(JsValue thisObj, JsValue[] arguments) + private JsValue Clear(JsValue thisObject, JsValue[] arguments) { - var map = AssertMapInstance(thisObj); + var map = AssertMapInstance(thisObject); map.Clear(); return Undefined; } - private JsValue Delete(JsValue thisObj, JsValue[] arguments) + private JsValue Delete(JsValue thisObject, JsValue[] arguments) { - var map = AssertMapInstance(thisObj); + var map = AssertMapInstance(thisObject); return map.MapDelete(arguments.At(0)) ? JsBoolean.True : JsBoolean.False; } - private JsValue Set(JsValue thisObj, JsValue[] arguments) + private JsValue Set(JsValue thisObject, JsValue[] arguments) { - var map = AssertMapInstance(thisObj); + var map = AssertMapInstance(thisObject); map.MapSet(arguments.At(0), arguments.At(1)); - return thisObj; + return thisObject; } - private JsValue Has(JsValue thisObj, JsValue[] arguments) + private JsValue Has(JsValue thisObject, JsValue[] arguments) { - var map = AssertMapInstance(thisObj); + var map = AssertMapInstance(thisObject); return map.Has(arguments.At(0)) ? JsBoolean.True : JsBoolean.False; } - private JsValue ForEach(JsValue thisObj, JsValue[] arguments) + private JsValue ForEach(JsValue thisObject, JsValue[] arguments) { - var map = AssertMapInstance(thisObj); + var map = AssertMapInstance(thisObject); var callbackfn = arguments.At(0); var thisArg = arguments.At(1); @@ -107,32 +107,32 @@ private JsValue ForEach(JsValue thisObj, JsValue[] arguments) return Undefined; } - private ObjectInstance Entries(JsValue thisObj, JsValue[] arguments) + private ObjectInstance Entries(JsValue thisObject, JsValue[] arguments) { - var map = AssertMapInstance(thisObj); + var map = AssertMapInstance(thisObject); return map.Iterator(); } - private ObjectInstance Keys(JsValue thisObj, JsValue[] arguments) + private ObjectInstance Keys(JsValue thisObject, JsValue[] arguments) { - var map = AssertMapInstance(thisObj); + var map = AssertMapInstance(thisObject); return map.Keys(); } - private ObjectInstance Values(JsValue thisObj, JsValue[] arguments) + private ObjectInstance Values(JsValue thisObject, JsValue[] arguments) { - var map = AssertMapInstance(thisObj); + var map = AssertMapInstance(thisObject); return map.Values(); } - private MapInstance AssertMapInstance(JsValue thisObj) + private MapInstance AssertMapInstance(JsValue thisObject) { - var map = thisObj as MapInstance; - if (map is null) + if (thisObject is MapInstance map) { - ExceptionHelper.ThrowTypeError(_realm, "object must be a Map"); + return map; } - return map; + ExceptionHelper.ThrowTypeError(_realm, "object must be a Map"); + return default; } } diff --git a/Jint/Native/Number/NumberConstructor.cs b/Jint/Native/Number/NumberConstructor.cs index c50524493b..69da694f85 100644 --- a/Jint/Native/Number/NumberConstructor.cs +++ b/Jint/Native/Number/NumberConstructor.cs @@ -53,7 +53,7 @@ protected override void Initialize() SetProperties(properties); } - private static JsValue IsFinite(JsValue thisObj, JsValue[] arguments) + private static JsValue IsFinite(JsValue thisObject, JsValue[] arguments) { if (!(arguments.At(0) is JsNumber num)) { @@ -63,7 +63,7 @@ private static JsValue IsFinite(JsValue thisObj, JsValue[] arguments) return double.IsInfinity(num._value) || double.IsNaN(num._value) ? JsBoolean.False : JsBoolean.True; } - private static JsValue IsInteger(JsValue thisObj, JsValue[] arguments) + private static JsValue IsInteger(JsValue thisObject, JsValue[] arguments) { if (!(arguments.At(0) is JsNumber num)) { @@ -80,7 +80,7 @@ private static JsValue IsInteger(JsValue thisObj, JsValue[] arguments) return integer == num._value; } - private static JsValue IsNaN(JsValue thisObj, JsValue[] arguments) + private static JsValue IsNaN(JsValue thisObject, JsValue[] arguments) { if (!(arguments.At(0) is JsNumber num)) { @@ -90,7 +90,7 @@ private static JsValue IsNaN(JsValue thisObj, JsValue[] arguments) return double.IsNaN(num._value); } - private static JsValue IsSafeInteger(JsValue thisObj, JsValue[] arguments) + private static JsValue IsSafeInteger(JsValue thisObject, JsValue[] arguments) { if (!(arguments.At(0) is JsNumber num)) { diff --git a/Jint/Native/Number/NumberPrototype.cs b/Jint/Native/Number/NumberPrototype.cs index 00d9eb4d2d..af302d7e5a 100644 --- a/Jint/Native/Number/NumberPrototype.cs +++ b/Jint/Native/Number/NumberPrototype.cs @@ -83,16 +83,16 @@ private JsValue ToLocaleString(JsValue thisObject, JsValue[] arguments) return m.ToString("n", Engine.Options.Culture); } - private JsValue ValueOf(JsValue thisObj, JsValue[] arguments) + private JsValue ValueOf(JsValue thisObject, JsValue[] arguments) { - if (thisObj is NumberInstance ni) + if (thisObject is NumberInstance ni) { return ni.NumberData; } - if (thisObj is JsNumber) + if (thisObject is JsNumber) { - return thisObj; + return thisObject; } ExceptionHelper.ThrowTypeError(_realm); @@ -101,7 +101,7 @@ private JsValue ValueOf(JsValue thisObj, JsValue[] arguments) private const double Ten21 = 1e21; - private JsValue ToFixed(JsValue thisObj, JsValue[] arguments) + private JsValue ToFixed(JsValue thisObject, JsValue[] arguments) { var f = (int) TypeConverter.ToInteger(arguments.At(0, 0)); if (f < 0 || f > 100) @@ -115,7 +115,7 @@ private JsValue ToFixed(JsValue thisObj, JsValue[] arguments) ExceptionHelper.ThrowRangeError(_realm, "100 fraction digits is not supported due to .NET format specifier limitation"); } - var x = TypeConverter.ToNumber(thisObj); + var x = TypeConverter.ToNumber(thisObject); if (double.IsNaN(x)) { @@ -139,14 +139,14 @@ private JsValue ToFixed(JsValue thisObj, JsValue[] arguments) /// /// https://www.ecma-international.org/ecma-262/6.0/#sec-number.prototype.toexponential /// - private JsValue ToExponential(JsValue thisObj, JsValue[] arguments) + private JsValue ToExponential(JsValue thisObject, JsValue[] arguments) { - if (!thisObj.IsNumber() && ReferenceEquals(thisObj.TryCast(), null)) + if (!thisObject.IsNumber() && ReferenceEquals(thisObject.TryCast(), null)) { ExceptionHelper.ThrowTypeError(_realm); } - var x = TypeConverter.ToNumber(thisObj); + var x = TypeConverter.ToNumber(thisObject); var fractionDigits = arguments.At(0); if (fractionDigits.IsUndefined()) { @@ -162,7 +162,7 @@ private JsValue ToExponential(JsValue thisObj, JsValue[] arguments) if (double.IsInfinity(x)) { - return thisObj.ToString(); + return thisObject.ToString(); } if (f < 0 || f > 100) @@ -216,14 +216,14 @@ private JsValue ToExponential(JsValue thisObj, JsValue[] arguments) return result; } - private JsValue ToPrecision(JsValue thisObj, JsValue[] arguments) + private JsValue ToPrecision(JsValue thisObject, JsValue[] arguments) { - if (!thisObj.IsNumber() && ReferenceEquals(thisObj.TryCast(), null)) + if (!thisObject.IsNumber() && ReferenceEquals(thisObject.TryCast(), null)) { ExceptionHelper.ThrowTypeError(_realm); } - var x = TypeConverter.ToNumber(thisObj); + var x = TypeConverter.ToNumber(thisObject); var precisionArgument = arguments.At(0); if (precisionArgument.IsUndefined()) @@ -240,7 +240,7 @@ private JsValue ToPrecision(JsValue thisObj, JsValue[] arguments) if (double.IsInfinity(x)) { - return thisObj.ToString(); + return thisObject.ToString(); } if (p < 1 || p > 100) diff --git a/Jint/Native/Promise/PromiseConstructor.cs b/Jint/Native/Promise/PromiseConstructor.cs index d88c71d40d..bd1c1259cb 100644 --- a/Jint/Native/Promise/PromiseConstructor.cs +++ b/Jint/Native/Promise/PromiseConstructor.cs @@ -97,37 +97,37 @@ public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget) /// /// https://tc39.es/ecma262/#sec-promise.resolve /// - internal JsValue Resolve(JsValue thisObj, JsValue[] arguments) + internal JsValue Resolve(JsValue thisObject, JsValue[] arguments) { - if (!thisObj.IsObject()) + if (!thisObject.IsObject()) { ExceptionHelper.ThrowTypeError(_realm, "PromiseResolve called on non-object"); } - if (thisObj is not IConstructor) + if (thisObject is not IConstructor) { ExceptionHelper.ThrowTypeError(_realm, "Promise.resolve invoked on a non-constructor value"); } var x = arguments.At(0); - return PromiseResolve(thisObj, x); + return PromiseResolve(thisObject, x); } /// /// https://tc39.es/ecma262/#sec-promise-resolve /// - private JsValue PromiseResolve(JsValue thisObj, JsValue x) + private JsValue PromiseResolve(JsValue thisObject, JsValue x) { if (x.IsPromise()) { var xConstructor = x.Get(CommonProperties.Constructor); - if (SameValue(xConstructor, thisObj)) + if (SameValue(xConstructor, thisObject)) { return x; } } - var (instance, resolve, _, _, _) = NewPromiseCapability(_engine, thisObj); + var (instance, resolve, _, _, _) = NewPromiseCapability(_engine, thisObject); resolve.Call(Undefined, new[] { x }); @@ -137,21 +137,21 @@ private JsValue PromiseResolve(JsValue thisObj, JsValue x) /// /// https://tc39.es/ecma262/#sec-promise.reject /// - private JsValue Reject(JsValue thisObj, JsValue[] arguments) + private JsValue Reject(JsValue thisObject, JsValue[] arguments) { - if (!thisObj.IsObject()) + if (!thisObject.IsObject()) { ExceptionHelper.ThrowTypeError(_realm, "Promise.reject called on non-object"); } - if (thisObj is not IConstructor) + if (thisObject is not IConstructor) { ExceptionHelper.ThrowTypeError(_realm, "Promise.reject invoked on a non-constructor value"); } var r = arguments.At(0); - var (instance, _, reject, _, _) = NewPromiseCapability(_engine, thisObj); + var (instance, _, reject, _, _) = NewPromiseCapability(_engine, thisObject); reject.Call(Undefined, new[] { r }); @@ -161,22 +161,22 @@ private JsValue Reject(JsValue thisObj, JsValue[] arguments) // This helper methods executes the first 6 steps in the specs belonging to static Promise methods like all, any etc. // If it returns false, that means it has an error and it is already rejected // If it returns true, the logic specific to the calling function should continue executing - private bool TryGetPromiseCapabilityAndIterator(JsValue thisObj, JsValue[] arguments, string callerName, out PromiseCapability capability, out ICallable promiseResolve, out IteratorInstance iterator) + private bool TryGetPromiseCapabilityAndIterator(JsValue thisObject, JsValue[] arguments, string callerName, out PromiseCapability capability, out ICallable promiseResolve, out IteratorInstance iterator) { - if (!thisObj.IsObject()) + if (!thisObject.IsObject()) { ExceptionHelper.ThrowTypeError(_realm, $"{callerName} called on non-object"); } //2. Let promiseCapability be ? NewPromiseCapability(C). - capability = NewPromiseCapability(_engine, thisObj); + capability = NewPromiseCapability(_engine, thisObject); var reject = capability.Reject; //3. Let promiseResolve be GetPromiseResolve(C). // 4. IfAbruptRejectPromise(promiseResolve, promiseCapability). try { - promiseResolve = GetPromiseResolve(thisObj); + promiseResolve = GetPromiseResolve(thisObject); } catch (JavaScriptException e) { @@ -212,9 +212,9 @@ private bool TryGetPromiseCapabilityAndIterator(JsValue thisObj, JsValue[] argum } // https://tc39.es/ecma262/#sec-promise.all - private JsValue All(JsValue thisObj, JsValue[] arguments) + private JsValue All(JsValue thisObject, JsValue[] arguments) { - if (!TryGetPromiseCapabilityAndIterator(thisObj, arguments, "Promise.all", out var capability, out var promiseResolve, out var iterator)) + if (!TryGetPromiseCapabilityAndIterator(thisObject, arguments, "Promise.all", out var capability, out var promiseResolve, out var iterator)) return capability.PromiseInstance; var (resultingPromise, resolve, reject, _, rejectObj) = capability; @@ -267,7 +267,7 @@ void ResolveIfFinished() // In F# it would be Option results.Add(null!); - var item = promiseResolve.Call(thisObj, new JsValue[] { value }); + var item = promiseResolve.Call(thisObject, new JsValue[] { value }); var thenProps = item.Get("then"); if (thenProps is ICallable thenFunc) { @@ -308,9 +308,9 @@ void ResolveIfFinished() } // https://tc39.es/ecma262/#sec-promise.allsettled - private JsValue AllSettled(JsValue thisObj, JsValue[] arguments) + private JsValue AllSettled(JsValue thisObject, JsValue[] arguments) { - if (!TryGetPromiseCapabilityAndIterator(thisObj, arguments, "Promise.allSettled", out var capability, out var promiseResolve, out var iterator)) + if (!TryGetPromiseCapabilityAndIterator(thisObject, arguments, "Promise.allSettled", out var capability, out var promiseResolve, out var iterator)) return capability.PromiseInstance; var (resultingPromise, resolve, reject, _, rejectObj) = capability; @@ -363,7 +363,7 @@ void ResolveIfFinished() // In F# it would be Option results.Add(null!); - var item = promiseResolve.Call(thisObj, new JsValue[] { value }); + var item = promiseResolve.Call(thisObject, new JsValue[] { value }); var thenProps = item.Get("then"); if (thenProps is ICallable thenFunc) { @@ -426,9 +426,9 @@ void ResolveIfFinished() } // https://tc39.es/ecma262/#sec-promise.any - private JsValue Any(JsValue thisObj, JsValue[] arguments) + private JsValue Any(JsValue thisObject, JsValue[] arguments) { - if (!TryGetPromiseCapabilityAndIterator(thisObj, arguments, "Promise.any", out var capability, out var promiseResolve, out var iterator)) + if (!TryGetPromiseCapabilityAndIterator(thisObject, arguments, "Promise.any", out var capability, out var promiseResolve, out var iterator)) { return capability.PromiseInstance; } @@ -488,7 +488,7 @@ void RejectIfAllRejected() // In F# it would be Option errors.Add(null!); - var item = promiseResolve.Call(thisObj, new JsValue[] { value }); + var item = promiseResolve.Call(thisObject, new JsValue[] { value }); var thenProps = item.Get("then"); if (thenProps is ICallable thenFunc) { @@ -530,9 +530,9 @@ void RejectIfAllRejected() } // https://tc39.es/ecma262/#sec-promise.race - private JsValue Race(JsValue thisObj, JsValue[] arguments) + private JsValue Race(JsValue thisObject, JsValue[] arguments) { - if (!TryGetPromiseCapabilityAndIterator(thisObj, arguments, "Promise.race", out var capability, out var promiseResolve, out var iterator)) + if (!TryGetPromiseCapabilityAndIterator(thisObject, arguments, "Promise.race", out var capability, out var promiseResolve, out var iterator)) return capability.PromiseInstance; var (resultingPromise, resolve, reject, _, rejectObj) = capability; @@ -561,7 +561,7 @@ private JsValue Race(JsValue thisObj, JsValue[] arguments) } // h. Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »). - var nextPromise = promiseResolve.Call(thisObj, new JsValue[] { nextValue }); + var nextPromise = promiseResolve.Call(thisObject, new JsValue[] { nextValue }); // i. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], resultCapability.[[Reject]] »). @@ -633,7 +633,7 @@ internal static PromiseCapability NewPromiseCapability(Engine engine, JsValue c) JsValue? resolveArg = null; JsValue? rejectArg = null; - JsValue Executor(JsValue thisObj, JsValue[] arguments) + JsValue Executor(JsValue thisObject, JsValue[] arguments) { // 25.4.1.5.1 GetCapabilitiesExecutor Functions // 3. If promiseCapability.[[Resolve]] is not undefined, throw a TypeError exception. diff --git a/Jint/Native/Promise/PromiseInstance.cs b/Jint/Native/Promise/PromiseInstance.cs index e4e4329f54..6d0c2057e4 100644 --- a/Jint/Native/Promise/PromiseInstance.cs +++ b/Jint/Native/Promise/PromiseInstance.cs @@ -83,7 +83,7 @@ internal ResolvingFunctions CreateResolvingFunctions() } // https://tc39.es/ecma262/#sec-promise-resolve-functions - private JsValue Resolve(JsValue thisObj, JsValue[] arguments) + private JsValue Resolve(JsValue thisObject, JsValue[] arguments) { var result = arguments.At(0); return Resolve(result); @@ -126,7 +126,7 @@ internal JsValue Resolve(JsValue result) } // https://tc39.es/ecma262/#sec-promise-reject-functions - private JsValue Reject(JsValue thisObj, JsValue[] arguments) + private JsValue Reject(JsValue thisObject, JsValue[] arguments) { // Note that alreadyResolved logic lives in CreateResolvingFunctions method diff --git a/Jint/Native/Promise/PromisePrototype.cs b/Jint/Native/Promise/PromisePrototype.cs index a061e33166..36cf1692b8 100644 --- a/Jint/Native/Promise/PromisePrototype.cs +++ b/Jint/Native/Promise/PromisePrototype.cs @@ -50,7 +50,7 @@ protected override void Initialize() // 3. Let C be ? SpeciesConstructor(promise, %Promise%). // 4. Let resultCapability be ? NewPromiseCapability(C). // 5. Return PerformPromiseThen(promise, onFulfilled, onRejected, resultCapability). - private JsValue Then(JsValue thisValue, JsValue[] args) + private JsValue Then(JsValue thisValue, JsValue[] arguments) { // 1. Let promise be the this value. // 2. If IsPromise(promise) is false, throw a TypeError exception. @@ -67,7 +67,7 @@ private JsValue Then(JsValue thisValue, JsValue[] args) var capability = PromiseConstructor.NewPromiseCapability(_engine, (JsValue) ctor); // 5. Return PerformPromiseThen(promise, onFulfilled, onRejected, resultCapability). - return PromiseOperations.PerformPromiseThen(_engine, promise, args.At(0), args.At(1), capability); + return PromiseOperations.PerformPromiseThen(_engine, promise, arguments.At(0), arguments.At(1), capability); } // https://tc39.es/ecma262/#sec-promise.prototype.catch @@ -77,11 +77,11 @@ private JsValue Then(JsValue thisValue, JsValue[] args) // // 1. Let promise be the this value. // 2. Return ? Invoke(promise, "then", « undefined, onRejected »). - private JsValue Catch(JsValue thisValue, JsValue[] args) => - _engine.Invoke(thisValue, "then", new[] {Undefined, args.At(0)}); + private JsValue Catch(JsValue thisValue, JsValue[] arguments) => + _engine.Invoke(thisValue, "then", new[] {Undefined, arguments.At(0)}); // https://tc39.es/ecma262/#sec-promise.prototype.finally - private JsValue Finally(JsValue thisValue, JsValue[] args) + private JsValue Finally(JsValue thisValue, JsValue[] arguments) { // 1. Let promise be the this value. // 2. If Type(promise) is not Object, throw a TypeError exception. @@ -97,7 +97,7 @@ private JsValue Finally(JsValue thisValue, JsValue[] args) JsValue thenFinally; JsValue catchFinally; - var onFinally = args.At(0); + var onFinally = arguments.At(0); // 5. If IsCallable(onFinally) is false, then if (onFinally is not ICallable onFinallyFunc) diff --git a/Jint/Native/RegExp/RegExpPrototype.cs b/Jint/Native/RegExp/RegExpPrototype.cs index 8e2e8a09c5..265b6fb9f1 100644 --- a/Jint/Native/RegExp/RegExpPrototype.cs +++ b/Jint/Native/RegExp/RegExpPrototype.cs @@ -98,14 +98,14 @@ GetSetPropertyDescriptor CreateGetAccessorDescriptor(string name, Func /// https://tc39.es/ecma262/#sec-get-regexp.prototype.source /// - private JsValue Source(JsValue thisObj, JsValue[] arguments) + private JsValue Source(JsValue thisObject, JsValue[] arguments) { - if (ReferenceEquals(thisObj, this)) + if (ReferenceEquals(thisObject, this)) { return DefaultSource; } - var r = thisObj as JsRegExp; + var r = thisObject as JsRegExp; if (r is null) { ExceptionHelper.ThrowTypeError(_realm); @@ -126,9 +126,9 @@ private JsValue Source(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-regexp.prototype-@@replace /// - private JsValue Replace(JsValue thisObj, JsValue[] arguments) + private JsValue Replace(JsValue thisObject, JsValue[] arguments) { - var rx = AssertThisIsObjectInstance(thisObj, "RegExp.prototype.replace"); + var rx = AssertThisIsObjectInstance(thisObject, "RegExp.prototype.replace"); var s = TypeConverter.ToString(arguments.At(0)); var lengthS = s.Length; var replaceValue = arguments.At(1); @@ -428,9 +428,9 @@ internal static string GetSubstitution( /// /// https://tc39.es/ecma262/#sec-regexp.prototype-@@split /// - private JsValue Split(JsValue thisObj, JsValue[] arguments) + private JsValue Split(JsValue thisObject, JsValue[] arguments) { - var rx = AssertThisIsObjectInstance(thisObj, "RegExp.prototype.split"); + var rx = AssertThisIsObjectInstance(thisObject, "RegExp.prototype.split"); var s = TypeConverter.ToString(arguments.At(0)); var limit = arguments.At(1); var c = SpeciesConstructor(rx, _realm.Intrinsics.RegExp); @@ -585,9 +585,9 @@ private JsValue SplitSlow(string s, ObjectInstance splitter, bool unicodeMatchin return a; } - private JsValue Flags(JsValue thisObj, JsValue[] arguments) + private JsValue Flags(JsValue thisObject, JsValue[] arguments) { - var r = AssertThisIsObjectInstance(thisObj, "RegExp.prototype.flags"); + var r = AssertThisIsObjectInstance(thisObject, "RegExp.prototype.flags"); static string AddFlagIfPresent(JsValue o, JsValue p, char flag, string s) { @@ -606,9 +606,9 @@ static string AddFlagIfPresent(JsValue o, JsValue p, char flag, string s) return result; } - private JsValue ToRegExpString(JsValue thisObj, JsValue[] arguments) + private JsValue ToRegExpString(JsValue thisObject, JsValue[] arguments) { - var r = AssertThisIsObjectInstance(thisObj, "RegExp.prototype.toString"); + var r = AssertThisIsObjectInstance(thisObject, "RegExp.prototype.toString"); var pattern = TypeConverter.ToString(r.Get(PropertySource)); var flags = TypeConverter.ToString(r.Get(PropertyFlags)); @@ -616,9 +616,9 @@ private JsValue ToRegExpString(JsValue thisObj, JsValue[] arguments) return "/" + pattern + "/" + flags; } - private JsValue Test(JsValue thisObj, JsValue[] arguments) + private JsValue Test(JsValue thisObject, JsValue[] arguments) { - var r = AssertThisIsObjectInstance(thisObj, "RegExp.prototype.test"); + var r = AssertThisIsObjectInstance(thisObject, "RegExp.prototype.test"); var s = TypeConverter.ToString(arguments.At(0)); // check couple fast paths @@ -653,9 +653,9 @@ private JsValue Test(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-regexp.prototype-@@search /// - private JsValue Search(JsValue thisObj, JsValue[] arguments) + private JsValue Search(JsValue thisObject, JsValue[] arguments) { - var rx = AssertThisIsObjectInstance(thisObj, "RegExp.prototype.search"); + var rx = AssertThisIsObjectInstance(thisObject, "RegExp.prototype.search"); var s = TypeConverter.ToString(arguments.At(0)); var previousLastIndex = rx.Get(JsRegExp.PropertyLastIndex); @@ -682,9 +682,9 @@ private JsValue Search(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-regexp.prototype-@@match /// - private JsValue Match(JsValue thisObj, JsValue[] arguments) + private JsValue Match(JsValue thisObject, JsValue[] arguments) { - var rx = AssertThisIsObjectInstance(thisObj, "RegExp.prototype.match"); + var rx = AssertThisIsObjectInstance(thisObject, "RegExp.prototype.match"); var s = TypeConverter.ToString(arguments.At(0)); var flags = TypeConverter.ToString(rx.Get(PropertyFlags)); @@ -774,9 +774,9 @@ private JsValue MatchSlow(ObjectInstance rx, string s, bool fullUnicode) /// /// https://tc39.es/ecma262/#sec-regexp-prototype-matchall /// - private JsValue MatchAll(JsValue thisObj, JsValue[] arguments) + private JsValue MatchAll(JsValue thisObject, JsValue[] arguments) { - var r = AssertThisIsObjectInstance(thisObj, "RegExp.prototype.matchAll"); + var r = AssertThisIsObjectInstance(thisObject, "RegExp.prototype.matchAll"); var s = TypeConverter.ToString(arguments.At(0)); var c = SpeciesConstructor(r, _realm.Intrinsics.RegExp); @@ -1083,9 +1083,9 @@ private static JsValue GetMatchIndexPair(Engine engine, string s, JsNumber[] mat return groupNameFromNumber; } - private JsValue Exec(JsValue thisObj, JsValue[] arguments) + private JsValue Exec(JsValue thisObject, JsValue[] arguments) { - var r = thisObj as JsRegExp; + var r = thisObject as JsRegExp; if (r is null) { ExceptionHelper.ThrowTypeError(_engine.Realm); diff --git a/Jint/Native/Set/SetPrototype.cs b/Jint/Native/Set/SetPrototype.cs index ac6ea615e7..fd670e00ab 100644 --- a/Jint/Native/Set/SetPrototype.cs +++ b/Jint/Native/Set/SetPrototype.cs @@ -50,59 +50,59 @@ protected override void Initialize() SetSymbols(symbols); } - private JsValue Size(JsValue thisObj, JsValue[] arguments) + private JsValue Size(JsValue thisObject, JsValue[] arguments) { - AssertSetInstance(thisObj); + AssertSetInstance(thisObject); return JsNumber.Create(0); } - private JsValue Add(JsValue thisObj, JsValue[] arguments) + private JsValue Add(JsValue thisObject, JsValue[] arguments) { - var set = AssertSetInstance(thisObj); + var set = AssertSetInstance(thisObject); var value = arguments.At(0); if (value is JsNumber number && number.IsNegativeZero()) { value = JsNumber.PositiveZero; } set.Add(value); - return thisObj; + return thisObject; } - private JsValue Clear(JsValue thisObj, JsValue[] arguments) + private JsValue Clear(JsValue thisObject, JsValue[] arguments) { - var set = AssertSetInstance(thisObj); + var set = AssertSetInstance(thisObject); set.Clear(); return Undefined; } - private JsValue Delete(JsValue thisObj, JsValue[] arguments) + private JsValue Delete(JsValue thisObject, JsValue[] arguments) { - var set = AssertSetInstance(thisObj); + var set = AssertSetInstance(thisObject); return set.SetDelete(arguments.At(0)) ? JsBoolean.True : JsBoolean.False; } - private JsValue Has(JsValue thisObj, JsValue[] arguments) + private JsValue Has(JsValue thisObject, JsValue[] arguments) { - var set = AssertSetInstance(thisObj); + var set = AssertSetInstance(thisObject); return set.Has(arguments.At(0)) ? JsBoolean.True : JsBoolean.False; } - private JsValue Entries(JsValue thisObj, JsValue[] arguments) + private JsValue Entries(JsValue thisObject, JsValue[] arguments) { - var set = AssertSetInstance(thisObj); + var set = AssertSetInstance(thisObject); return set.Entries(); } - private JsValue ForEach(JsValue thisObj, JsValue[] arguments) + private JsValue ForEach(JsValue thisObject, JsValue[] arguments) { var callbackfn = arguments.At(0); var thisArg = arguments.At(1); - var set = AssertSetInstance(thisObj); + var set = AssertSetInstance(thisObject); var callable = GetCallable(callbackfn); set.ForEach(callable, thisArg); @@ -110,20 +110,20 @@ private JsValue ForEach(JsValue thisObj, JsValue[] arguments) return Undefined; } - private ObjectInstance Values(JsValue thisObj, JsValue[] arguments) + private ObjectInstance Values(JsValue thisObject, JsValue[] arguments) { - var set = AssertSetInstance(thisObj); + var set = AssertSetInstance(thisObject); return set.Values(); } - private SetInstance AssertSetInstance(JsValue thisObj) + private SetInstance AssertSetInstance(JsValue thisObject) { - var set = thisObj as SetInstance; - if (set is null) + if (thisObject is SetInstance set) { - ExceptionHelper.ThrowTypeError(_realm, "object must be a Set"); + return set; } - return set; + ExceptionHelper.ThrowTypeError(_realm, "object must be a Set"); + return default; } } diff --git a/Jint/Native/ShadowRealm/ShadowRealmPrototype.cs b/Jint/Native/ShadowRealm/ShadowRealmPrototype.cs index 5da949e2ef..75eaa59333 100644 --- a/Jint/Native/ShadowRealm/ShadowRealmPrototype.cs +++ b/Jint/Native/ShadowRealm/ShadowRealmPrototype.cs @@ -43,9 +43,9 @@ protected override void Initialize() /// /// https://tc39.es/proposal-shadowrealm/#sec-shadowrealm.prototype.evaluate /// - private JsValue Evaluate(JsValue thisObj, JsValue[] arguments) + private JsValue Evaluate(JsValue thisObject, JsValue[] arguments) { - var shadowRealm = ValidateShadowRealmObject(thisObj); + var shadowRealm = ValidateShadowRealmObject(thisObject); var sourceText = arguments.At(0); if (!sourceText.IsString()) @@ -59,12 +59,12 @@ private JsValue Evaluate(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/proposal-shadowrealm/#sec-shadowrealm.prototype.importvalue /// - private JsValue ImportValue(JsValue thisObj, JsValue[] arguments) + private JsValue ImportValue(JsValue thisObject, JsValue[] arguments) { var specifier = arguments.At(0); var exportName = arguments.At(1); - var O = ValidateShadowRealmObject(thisObj); + var O = ValidateShadowRealmObject(thisObject); var specifierString = TypeConverter.ToJsString(specifier); if (!specifier.IsString()) { @@ -80,14 +80,14 @@ private JsValue ImportValue(JsValue thisObj, JsValue[] arguments) return O.ShadowRealmImportValue(specifierString.ToString(), exportName.ToString(), callerRealm); } - private ShadowRealm ValidateShadowRealmObject(JsValue thisObj) + private ShadowRealm ValidateShadowRealmObject(JsValue thisObject) { - var instance = thisObj as ShadowRealm; - if (instance is null) + if (thisObject is ShadowRealm shadowRealm) { - ExceptionHelper.ThrowTypeError(_realm, "object must be a ShadowRealm"); + return shadowRealm; } - return instance; + ExceptionHelper.ThrowTypeError(_realm, "object must be a ShadowRealm"); + return default; } } diff --git a/Jint/Native/String/StringConstructor.cs b/Jint/Native/String/StringConstructor.cs index 0eb4af28d3..28caa2cc20 100644 --- a/Jint/Native/String/StringConstructor.cs +++ b/Jint/Native/String/StringConstructor.cs @@ -74,7 +74,7 @@ private static JsValue FromCharCode(JsValue? thisObj, JsValue[] arguments) return JsString.Create(new string(elements)); } - private JsValue FromCodePoint(JsValue thisObj, JsValue[] arguments) + private JsValue FromCodePoint(JsValue thisObject, JsValue[] arguments) { var codeUnits = new List(); string result = ""; @@ -117,7 +117,7 @@ private JsValue FromCodePoint(JsValue thisObj, JsValue[] arguments) /// /// https://www.ecma-international.org/ecma-262/6.0/#sec-string.raw /// - private JsValue Raw(JsValue thisObj, JsValue[] arguments) + private JsValue Raw(JsValue thisObject, JsValue[] arguments) { var cooked = TypeConverter.ToObject(_realm, arguments.At(0)); var raw = TypeConverter.ToObject(_realm, cooked.Get(JintTaggedTemplateExpression.PropertyRaw)); diff --git a/Jint/Native/String/StringPrototype.cs b/Jint/Native/String/StringPrototype.cs index 82f584f2ec..c781875a96 100644 --- a/Jint/Native/String/StringPrototype.cs +++ b/Jint/Native/String/StringPrototype.cs @@ -90,21 +90,21 @@ protected override void Initialize() SetSymbols(symbols); } - private ObjectInstance Iterator(JsValue thisObj, JsValue[] arguments) + private ObjectInstance Iterator(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(_engine, thisObj); - var str = TypeConverter.ToString(thisObj); + TypeConverter.CheckObjectCoercible(_engine, thisObject); + var str = TypeConverter.ToString(thisObject); return _realm.Intrinsics.StringIteratorPrototype.Construct(str); } - private JsValue ToStringString(JsValue thisObj, JsValue[] arguments) + private JsValue ToStringString(JsValue thisObject, JsValue[] arguments) { - if (thisObj.IsString()) + if (thisObject.IsString()) { - return thisObj; + return thisObject; } - var s = TypeConverter.ToObject(_realm, thisObj) as StringInstance; + var s = TypeConverter.ToObject(_realm, thisObject) as StringInstance; if (ReferenceEquals(s, null)) { ExceptionHelper.ThrowTypeError(_realm); @@ -185,10 +185,10 @@ internal static string TrimEx(string s) /// https://tc39.es/ecma262/#sec-string.prototype.trim /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private JsValue Trim(JsValue thisObj, JsValue[] arguments) + private JsValue Trim(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); - var s = TypeConverter.ToJsString(thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); + var s = TypeConverter.ToJsString(thisObject); if (s.Length == 0 || (!IsWhiteSpaceEx(s[0]) && !IsWhiteSpaceEx(s[s.Length - 1]))) { return s; @@ -199,10 +199,10 @@ private JsValue Trim(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.trimstart /// - private JsValue TrimStart(JsValue thisObj, JsValue[] arguments) + private JsValue TrimStart(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); - var s = TypeConverter.ToJsString(thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); + var s = TypeConverter.ToJsString(thisObject); if (s.Length == 0 || !IsWhiteSpaceEx(s[0])) { return s; @@ -213,10 +213,10 @@ private JsValue TrimStart(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.trimend /// - private JsValue TrimEnd(JsValue thisObj, JsValue[] arguments) + private JsValue TrimEnd(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); - var s = TypeConverter.ToJsString(thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); + var s = TypeConverter.ToJsString(thisObject); if (s.Length == 0 || !IsWhiteSpaceEx(s[s.Length - 1])) { return s; @@ -224,31 +224,31 @@ private JsValue TrimEnd(JsValue thisObj, JsValue[] arguments) return TrimEndEx(s.ToString()); } - private JsValue ToLocaleUpperCase(JsValue thisObj, JsValue[] arguments) + private JsValue ToLocaleUpperCase(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(_engine, thisObj); - var s = TypeConverter.ToString(thisObj); + TypeConverter.CheckObjectCoercible(_engine, thisObject); + var s = TypeConverter.ToString(thisObject); return new JsString(s.ToUpper()); } - private JsValue ToUpperCase(JsValue thisObj, JsValue[] arguments) + private JsValue ToUpperCase(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(_engine, thisObj); - var s = TypeConverter.ToString(thisObj); + TypeConverter.CheckObjectCoercible(_engine, thisObject); + var s = TypeConverter.ToString(thisObject); return new JsString(s.ToUpperInvariant()); } - private JsValue ToLocaleLowerCase(JsValue thisObj, JsValue[] arguments) + private JsValue ToLocaleLowerCase(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(_engine, thisObj); - var s = TypeConverter.ToString(thisObj); + TypeConverter.CheckObjectCoercible(_engine, thisObject); + var s = TypeConverter.ToString(thisObject); return new JsString(s.ToLower()); } - private JsValue ToLowerCase(JsValue thisObj, JsValue[] arguments) + private JsValue ToLowerCase(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(_engine, thisObj); - var s = TypeConverter.ToString(thisObj); + TypeConverter.CheckObjectCoercible(_engine, thisObject); + var s = TypeConverter.ToString(thisObject); return s.ToLowerInvariant(); } @@ -273,11 +273,11 @@ private static int ToIntegerSupportInfinityUnlikely(JsValue numberVal) return intVal; } - private JsValue Substring(JsValue thisObj, JsValue[] arguments) + private JsValue Substring(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); - var s = TypeConverter.ToString(thisObj); + var s = TypeConverter.ToString(thisObject); var start = TypeConverter.ToNumber(arguments.At(0)); var end = TypeConverter.ToNumber(arguments.At(1)); @@ -315,9 +315,9 @@ private JsValue Substring(JsValue thisObj, JsValue[] arguments) return new JsString(s.Substring(from, length)); } - private static JsValue Substr(JsValue thisObj, JsValue[] arguments) + private static JsValue Substr(JsValue thisObject, JsValue[] arguments) { - var s = TypeConverter.ToString(thisObj); + var s = TypeConverter.ToString(thisObject); var start = TypeConverter.ToInteger(arguments.At(0)); var length = arguments.At(1).IsUndefined() ? double.PositiveInfinity @@ -342,9 +342,9 @@ private static JsValue Substr(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.split /// - private JsValue Split(JsValue thisObj, JsValue[] arguments) + private JsValue Split(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); var separator = arguments.At(0); var limit = arguments.At(1); @@ -360,11 +360,11 @@ private JsValue Split(JsValue thisObj, JsValue[] arguments) var splitter = GetMethod(_realm, oi, GlobalSymbolRegistry.Split); if (splitter != null) { - return splitter.Call(separator, new[] { thisObj, limit }); + return splitter.Call(separator, new[] { thisObject, limit }); } } - var s = TypeConverter.ToString(thisObj); + var s = TypeConverter.ToString(thisObject); // Coerce into a number, true will become 1 var lim = limit.IsUndefined() ? uint.MaxValue : TypeConverter.ToUint32(limit); @@ -435,12 +435,12 @@ internal static JsValue SplitWithStringSeparator(Realm realm, JsValue separator, /// /// https://tc39.es/proposal-relative-indexing-method/#sec-string-prototype-additions /// - private JsValue At(JsValue thisObj, JsValue[] arguments) + private JsValue At(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(_engine, thisObj); + TypeConverter.CheckObjectCoercible(_engine, thisObject); var start = arguments.At(0); - var o = thisObj.ToString(); + var o = thisObject.ToString(); long len = o.Length; var relativeIndex = TypeConverter.ToInteger(start); @@ -463,9 +463,9 @@ private JsValue At(JsValue thisObj, JsValue[] arguments) return o[k]; } - private JsValue Slice(JsValue thisObj, JsValue[] arguments) + private JsValue Slice(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); var start = TypeConverter.ToNumber(arguments.At(0)); if (double.IsNegativeInfinity(start)) @@ -477,7 +477,7 @@ private JsValue Slice(JsValue thisObj, JsValue[] arguments) return JsString.Empty; } - var s = TypeConverter.ToJsString(thisObj); + var s = TypeConverter.ToJsString(thisObject); var end = TypeConverter.ToNumber(arguments.At(1)); if (double.IsPositiveInfinity(end)) { @@ -504,9 +504,9 @@ private JsValue Slice(JsValue thisObj, JsValue[] arguments) return s.Substring(from, span); } - private JsValue Search(JsValue thisObj, JsValue[] arguments) + private JsValue Search(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); var regex = arguments.At(0); if (regex is ObjectInstance oi) @@ -514,21 +514,21 @@ private JsValue Search(JsValue thisObj, JsValue[] arguments) var searcher = GetMethod(_realm, oi, GlobalSymbolRegistry.Search); if (searcher != null) { - return searcher.Call(regex, new[] { thisObj }); + return searcher.Call(regex, new[] { thisObject }); } } var rx = (JsRegExp) _realm.Intrinsics.RegExp.Construct(new[] {regex}); - var s = TypeConverter.ToJsString(thisObj); + var s = TypeConverter.ToJsString(thisObject); return _engine.Invoke(rx, GlobalSymbolRegistry.Search, new JsValue[] { s }); } /// /// https://tc39.es/ecma262/#sec-string.prototype.replace /// - private JsValue Replace(JsValue thisObj, JsValue[] arguments) + private JsValue Replace(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); var searchValue = arguments.At(0); var replaceValue = arguments.At(1); @@ -538,11 +538,11 @@ private JsValue Replace(JsValue thisObj, JsValue[] arguments) var replacer = GetMethod(_realm, searchValue, GlobalSymbolRegistry.Replace); if (replacer != null) { - return replacer.Call(searchValue, thisObj, replaceValue); + return replacer.Call(searchValue, thisObject, replaceValue); } } - var thisString = TypeConverter.ToJsString(thisObj); + var thisString = TypeConverter.ToJsString(thisObject); var searchString = TypeConverter.ToString(searchValue); var functionalReplace = replaceValue is ICallable; @@ -578,9 +578,9 @@ private JsValue Replace(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.replaceall /// - private JsValue ReplaceAll(JsValue thisObj, JsValue[] arguments) + private JsValue ReplaceAll(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); var searchValue = arguments.At(0); var replaceValue = arguments.At(1); @@ -600,11 +600,11 @@ private JsValue ReplaceAll(JsValue thisObj, JsValue[] arguments) var replacer = GetMethod(_realm, searchValue, GlobalSymbolRegistry.Replace); if (replacer != null) { - return replacer.Call(searchValue, thisObj, replaceValue); + return replacer.Call(searchValue, thisObject, replaceValue); } } - var thisString = TypeConverter.ToString(thisObj); + var thisString = TypeConverter.ToString(thisObject); var searchString = TypeConverter.ToString(searchValue); var functionalReplace = replaceValue is ICallable; @@ -672,9 +672,9 @@ static int StringIndexOf(string s, string search, int fromIndex) return result.ToString(); } - private JsValue Match(JsValue thisObj, JsValue[] arguments) + private JsValue Match(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); var regex = arguments.At(0); if (regex is ObjectInstance oi) @@ -682,19 +682,19 @@ private JsValue Match(JsValue thisObj, JsValue[] arguments) var matcher = GetMethod(_realm, oi, GlobalSymbolRegistry.Match); if (matcher != null) { - return matcher.Call(regex, new[] { thisObj }); + return matcher.Call(regex, new[] { thisObject }); } } var rx = (JsRegExp) _realm.Intrinsics.RegExp.Construct(new[] {regex}); - var s = TypeConverter.ToJsString(thisObj); + var s = TypeConverter.ToJsString(thisObject); return _engine.Invoke(rx, GlobalSymbolRegistry.Match, new JsValue[] { s }); } - private JsValue MatchAll(JsValue thisObj, JsValue[] arguments) + private JsValue MatchAll(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(_engine, thisObj); + TypeConverter.CheckObjectCoercible(_engine, thisObject); var regex = arguments.At(0); if (!regex.IsNullOrUndefined()) @@ -711,21 +711,21 @@ private JsValue MatchAll(JsValue thisObj, JsValue[] arguments) var matcher = GetMethod(_realm, (ObjectInstance) regex, GlobalSymbolRegistry.MatchAll); if (matcher != null) { - return matcher.Call(regex, new[] { thisObj }); + return matcher.Call(regex, new[] { thisObject }); } } - var s = TypeConverter.ToJsString(thisObj); + var s = TypeConverter.ToJsString(thisObject); var rx = (JsRegExp) _realm.Intrinsics.RegExp.Construct(new[] { regex, "g" }); return _engine.Invoke(rx, GlobalSymbolRegistry.MatchAll, new JsValue[] { s }); } - private JsValue LocaleCompare(JsValue thisObj, JsValue[] arguments) + private JsValue LocaleCompare(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); - var s = TypeConverter.ToString(thisObj); + var s = TypeConverter.ToString(thisObject); var that = TypeConverter.ToString(arguments.At(0)); return string.CompareOrdinal(s.Normalize(NormalizationForm.FormKD), that.Normalize(NormalizationForm.FormKD)); @@ -734,11 +734,11 @@ private JsValue LocaleCompare(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.lastindexof /// - private JsValue LastIndexOf(JsValue thisObj, JsValue[] arguments) + private JsValue LastIndexOf(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); - var jsString = TypeConverter.ToJsString(thisObj); + var jsString = TypeConverter.ToJsString(thisObject); var searchStr = TypeConverter.ToString(arguments.At(0)); double numPos = double.NaN; if (arguments.Length > 1 && !arguments[1].IsUndefined()) @@ -790,11 +790,11 @@ private JsValue LastIndexOf(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.indexof /// - private JsValue IndexOf(JsValue thisObj, JsValue[] arguments) + private JsValue IndexOf(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); - var s = TypeConverter.ToJsString(thisObj); + var s = TypeConverter.ToJsString(thisObject); var searchStr = TypeConverter.ToString(arguments.At(0)); double pos = 0; if (arguments.Length > 1 && !arguments[1].IsUndefined()) @@ -815,13 +815,13 @@ private JsValue IndexOf(JsValue thisObj, JsValue[] arguments) return s.IndexOf(searchStr, (int) pos); } - private JsValue Concat(JsValue thisObj, JsValue[] arguments) + private JsValue Concat(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); - if (thisObj is not JsString jsString) + if (thisObject is not JsString jsString) { - jsString = new JsString.ConcatenatedString(TypeConverter.ToString(thisObj)); + jsString = new JsString.ConcatenatedString(TypeConverter.ToString(thisObject)); } else { @@ -836,12 +836,12 @@ private JsValue Concat(JsValue thisObj, JsValue[] arguments) return jsString; } - private JsValue CharCodeAt(JsValue thisObj, JsValue[] arguments) + private JsValue CharCodeAt(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); JsValue pos = arguments.Length > 0 ? arguments[0] : 0; - var s = TypeConverter.ToJsString(thisObj); + var s = TypeConverter.ToJsString(thisObject); var position = (int) TypeConverter.ToInteger(pos); if (position < 0 || position >= s.Length) { @@ -853,12 +853,12 @@ private JsValue CharCodeAt(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.codepointat /// - private JsValue CodePointAt(JsValue thisObj, JsValue[] arguments) + private JsValue CodePointAt(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); JsValue pos = arguments.Length > 0 ? arguments[0] : 0; - var s = TypeConverter.ToString(thisObj); + var s = TypeConverter.ToString(thisObject); var position = (int)TypeConverter.ToInteger(pos); if (position < 0 || position >= s.Length) { @@ -897,10 +897,10 @@ private static CodePointResult CodePointAt(string s, int position) return new CodePointResult(char.ConvertToUtf32(first, second), 2, false); } - private JsValue CharAt(JsValue thisObj, JsValue[] arguments) + private JsValue CharAt(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); - var s = TypeConverter.ToJsString(thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); + var s = TypeConverter.ToJsString(thisObject); var position = TypeConverter.ToInteger(arguments.At(0)); var size = s.Length; if (position >= size || position < 0) @@ -910,16 +910,16 @@ private JsValue CharAt(JsValue thisObj, JsValue[] arguments) return JsString.Create(s[(int) position]); } - private JsValue ValueOf(JsValue thisObj, JsValue[] arguments) + private JsValue ValueOf(JsValue thisObject, JsValue[] arguments) { - if (thisObj is StringInstance si) + if (thisObject is StringInstance si) { return si.StringData; } - if (thisObj is JsString) + if (thisObject is JsString) { - return thisObj; + return thisObject; } ExceptionHelper.ThrowTypeError(_realm); @@ -929,26 +929,26 @@ private JsValue ValueOf(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.padstart /// - private JsValue PadStart(JsValue thisObj, JsValue[] arguments) + private JsValue PadStart(JsValue thisObject, JsValue[] arguments) { - return StringPad(thisObj, arguments, true); + return StringPad(thisObject, arguments, true); } /// /// https://tc39.es/ecma262/#sec-string.prototype.padend /// - private JsValue PadEnd(JsValue thisObj, JsValue[] arguments) + private JsValue PadEnd(JsValue thisObject, JsValue[] arguments) { - return StringPad(thisObj, arguments, false); + return StringPad(thisObject, arguments, false); } /// /// https://tc39.es/ecma262/#sec-stringpad /// - private JsValue StringPad(JsValue thisObj, JsValue[] arguments, bool padStart) + private JsValue StringPad(JsValue thisObject, JsValue[] arguments, bool padStart) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); - var s = TypeConverter.ToJsString(thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); + var s = TypeConverter.ToJsString(thisObject); var targetLength = TypeConverter.ToInt32(arguments.At(0)); var padStringValue = arguments.At(1); @@ -976,11 +976,11 @@ private JsValue StringPad(JsValue thisObj, JsValue[] arguments, bool padStart) /// /// https://tc39.es/ecma262/#sec-string.prototype.startswith /// - private JsValue StartsWith(JsValue thisObj, JsValue[] arguments) + private JsValue StartsWith(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); - var s = TypeConverter.ToJsString(thisObj); + var s = TypeConverter.ToJsString(thisObject); var searchString = arguments.At(0); if (ReferenceEquals(searchString, Null)) @@ -1008,11 +1008,11 @@ private JsValue StartsWith(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.endswith /// - private JsValue EndsWith(JsValue thisObj, JsValue[] arguments) + private JsValue EndsWith(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); - var s = TypeConverter.ToJsString(thisObj); + var s = TypeConverter.ToJsString(thisObject); var searchString = arguments.At(0); if (ReferenceEquals(searchString, Null)) @@ -1039,11 +1039,11 @@ private JsValue EndsWith(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.includes /// - private JsValue Includes(JsValue thisObj, JsValue[] arguments) + private JsValue Includes(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); - var s = TypeConverter.ToJsString(thisObj); + var s = TypeConverter.ToJsString(thisObject); var searchString = arguments.At(0); if (searchString.IsRegExp()) @@ -1071,10 +1071,10 @@ private JsValue Includes(JsValue thisObj, JsValue[] arguments) return s.IndexOf(searchStr, (int) pos) > -1; } - private JsValue Normalize(JsValue thisObj, JsValue[] arguments) + private JsValue Normalize(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); - var str = TypeConverter.ToString(thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); + var str = TypeConverter.ToString(thisObject); var param = arguments.At(0); @@ -1112,10 +1112,10 @@ private JsValue Normalize(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-string.prototype.repeat /// - private JsValue Repeat(JsValue thisObj, JsValue[] arguments) + private JsValue Repeat(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(Engine, thisObj); - var s = TypeConverter.ToString(thisObj); + TypeConverter.CheckObjectCoercible(Engine, thisObject); + var s = TypeConverter.ToString(thisObject); var count = arguments.At(0); var n = TypeConverter.ToIntegerOrInfinity(count); @@ -1145,18 +1145,18 @@ private JsValue Repeat(JsValue thisObj, JsValue[] arguments) return sb.ToString(); } - private JsValue IsWellFormed(JsValue thisObj, JsValue[] arguments) + private JsValue IsWellFormed(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(_engine, thisObj); - var s = TypeConverter.ToString(thisObj); + TypeConverter.CheckObjectCoercible(_engine, thisObject); + var s = TypeConverter.ToString(thisObject); return IsStringWellFormedUnicode(s); } - private JsValue ToWellFormed(JsValue thisObj, JsValue[] arguments) + private JsValue ToWellFormed(JsValue thisObject, JsValue[] arguments) { - TypeConverter.CheckObjectCoercible(_engine, thisObj); - var s = TypeConverter.ToString(thisObj); + TypeConverter.CheckObjectCoercible(_engine, thisObject); + var s = TypeConverter.ToString(thisObject); var strLen = s.Length; var k = 0; diff --git a/Jint/Native/Symbol/SymbolConstructor.cs b/Jint/Native/Symbol/SymbolConstructor.cs index e729b11466..0252db8164 100644 --- a/Jint/Native/Symbol/SymbolConstructor.cs +++ b/Jint/Native/Symbol/SymbolConstructor.cs @@ -73,7 +73,7 @@ protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments /// /// https://tc39.es/ecma262/#sec-symbol.for /// - private JsValue For(JsValue thisObj, JsValue[] arguments) + private JsValue For(JsValue thisObject, JsValue[] arguments) { var stringKey = TypeConverter.ToJsString(arguments.At(0)); @@ -91,7 +91,7 @@ private JsValue For(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-symbol.keyfor /// - private JsValue KeyFor(JsValue thisObj, JsValue[] arguments) + private JsValue KeyFor(JsValue thisObject, JsValue[] arguments) { var symbol = arguments.At(0) as JsSymbol; if (symbol is null) diff --git a/Jint/Native/TypedArray/IntrinsicTypedArrayConstructor.cs b/Jint/Native/TypedArray/IntrinsicTypedArrayConstructor.cs index 87d9163a92..9b019a099c 100644 --- a/Jint/Native/TypedArray/IntrinsicTypedArrayConstructor.cs +++ b/Jint/Native/TypedArray/IntrinsicTypedArrayConstructor.cs @@ -46,9 +46,9 @@ protected override void Initialize() /// /// https://tc39.es/ecma262/#sec-%typedarray%.from /// - private JsValue From(JsValue thisObj, JsValue[] arguments) + private JsValue From(JsValue thisObject, JsValue[] arguments) { - var c = thisObj; + var c = thisObject; if (!c.IsConstructor) { ExceptionHelper.ThrowTypeError(_realm); @@ -122,16 +122,16 @@ private JsValue From(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.of /// - private JsValue Of(JsValue thisObj, JsValue[] items) + private JsValue Of(JsValue thisObject, JsValue[] items) { var len = items.Length; - if (!thisObj.IsConstructor) + if (!thisObject.IsConstructor) { ExceptionHelper.ThrowTypeError(_realm); } - var newObj = TypedArrayCreate(_realm, (IConstructor) thisObj, new JsValue[] { len }); + var newObj = TypedArrayCreate(_realm, (IConstructor) thisObject, new JsValue[] { len }); var k = 0; while (k < len) @@ -188,7 +188,7 @@ protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments return Undefined; } - public override ObjectInstance Construct(JsValue[] args, JsValue newTarget) + public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget) { ExceptionHelper.ThrowTypeError(_realm, "Abstract class TypedArray not directly constructable"); return null; diff --git a/Jint/Native/TypedArray/IntrinsicTypedArrayPrototype.cs b/Jint/Native/TypedArray/IntrinsicTypedArrayPrototype.cs index 51e37dfd45..039b84a97d 100644 --- a/Jint/Native/TypedArray/IntrinsicTypedArrayPrototype.cs +++ b/Jint/Native/TypedArray/IntrinsicTypedArrayPrototype.cs @@ -87,9 +87,9 @@ protected override void Initialize() /// /// https://tc39.es/ecma262/#sec-get-%typedarray%.prototype.buffer /// - private JsValue Buffer(JsValue thisObj, JsValue[] arguments) + private JsValue Buffer(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsTypedArray; + var o = thisObject as JsTypedArray; if (o is null) { ExceptionHelper.ThrowTypeError(_realm); @@ -101,9 +101,9 @@ private JsValue Buffer(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-get-%typedarray%.prototype.bytelength /// - private JsValue ByteLength(JsValue thisObj, JsValue[] arguments) + private JsValue ByteLength(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsTypedArray; + var o = thisObject as JsTypedArray; if (o is null) { ExceptionHelper.ThrowTypeError(_realm); @@ -120,9 +120,9 @@ private JsValue ByteLength(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-get-%typedarray%.prototype.byteoffset /// - private JsValue ByteOffset(JsValue thisObj, JsValue[] arguments) + private JsValue ByteOffset(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsTypedArray; + var o = thisObject as JsTypedArray; if (o is null) { ExceptionHelper.ThrowTypeError(_realm); @@ -139,9 +139,9 @@ private JsValue ByteOffset(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-get-%typedarray%.prototype.length /// - private JsValue GetLength(JsValue thisObj, JsValue[] arguments) + private JsValue GetLength(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsTypedArray; + var o = thisObject as JsTypedArray; if (o is null) { ExceptionHelper.ThrowTypeError(_realm); @@ -159,9 +159,9 @@ private JsValue GetLength(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin /// - private JsValue CopyWithin(JsValue thisObj, JsValue[] arguments) + private JsValue CopyWithin(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var target = arguments.At(0); var start = arguments.At(1); @@ -260,18 +260,18 @@ private JsValue CopyWithin(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries /// - private JsValue Entries(JsValue thisObj, JsValue[] arguments) + private JsValue Entries(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); return _realm.Intrinsics.ArrayIteratorPrototype.Construct(o, ArrayIteratorType.KeyAndValue); } /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.every /// - private JsValue Every(JsValue thisObj, JsValue[] arguments) + private JsValue Every(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = o.Length; if (len == 0) @@ -302,9 +302,9 @@ private JsValue Every(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill /// - private JsValue Fill(JsValue thisObj, JsValue[] arguments) + private JsValue Fill(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var jsValue = arguments.At(0); var start = arguments.At(1); @@ -359,18 +359,18 @@ private JsValue Fill(JsValue thisObj, JsValue[] arguments) o[i] = value; } - return thisObj; + return thisObject; } /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter /// - private JsValue Filter(JsValue thisObj, JsValue[] arguments) + private JsValue Filter(JsValue thisObject, JsValue[] arguments) { var callbackfn = GetCallable(arguments.At(0)); var thisArg = arguments.At(1); - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = o.Length; var kept = new List(); @@ -405,32 +405,32 @@ private JsValue Filter(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.find /// - private JsValue Find(JsValue thisObj, JsValue[] arguments) + private JsValue Find(JsValue thisObject, JsValue[] arguments) { - return DoFind(thisObj, arguments).Value; + return DoFind(thisObject, arguments).Value; } /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex /// - private JsValue FindIndex(JsValue thisObj, JsValue[] arguments) + private JsValue FindIndex(JsValue thisObject, JsValue[] arguments) { - return DoFind(thisObj, arguments).Key; + return DoFind(thisObject, arguments).Key; } - private JsValue FindLast(JsValue thisObj, JsValue[] arguments) + private JsValue FindLast(JsValue thisObject, JsValue[] arguments) { - return DoFind(thisObj, arguments, fromEnd: true).Value; + return DoFind(thisObject, arguments, fromEnd: true).Value; } - private JsValue FindLastIndex(JsValue thisObj, JsValue[] arguments) + private JsValue FindLastIndex(JsValue thisObject, JsValue[] arguments) { - return DoFind(thisObj, arguments, fromEnd: true).Key; + return DoFind(thisObject, arguments, fromEnd: true).Key; } - private KeyValuePair DoFind(JsValue thisObj, JsValue[] arguments, bool fromEnd = false) + private KeyValuePair DoFind(JsValue thisObject, JsValue[] arguments, bool fromEnd = false) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = (int) o.Length; var predicate = GetCallable(arguments.At(0)); @@ -473,12 +473,12 @@ private KeyValuePair DoFind(JsValue thisObj, JsValue[] argumen /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach /// - private JsValue ForEach(JsValue thisObj, JsValue[] arguments) + private JsValue ForEach(JsValue thisObject, JsValue[] arguments) { var callbackfn = GetCallable(arguments.At(0)); var thisArg = arguments.At(1); - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = o.Length; var args = _engine._jsValueArrayPool.RentArray(3); @@ -499,9 +499,9 @@ private JsValue ForEach(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes /// - private JsValue Includes(JsValue thisObj, JsValue[] arguments) + private JsValue Includes(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = o.Length; if (len == 0) @@ -553,12 +553,12 @@ private JsValue Includes(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof /// - private JsValue IndexOf(JsValue thisObj, JsValue[] arguments) + private JsValue IndexOf(JsValue thisObject, JsValue[] arguments) { var searchElement = arguments.At(0); var fromIndex = arguments.At(1); - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = o.Length; if (len == 0) { @@ -608,9 +608,9 @@ private JsValue IndexOf(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.join /// - private JsValue Join(JsValue thisObj, JsValue[] arguments) + private JsValue Join(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var separator = arguments.At(0); var len = o.Length; @@ -649,20 +649,20 @@ static string StringFromJsValue(JsValue value) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys /// - private JsValue Keys(JsValue thisObj, JsValue[] arguments) + private JsValue Keys(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); return _realm.Intrinsics.ArrayIteratorPrototype.Construct(o, ArrayIteratorType.Key); } /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof /// - private JsValue LastIndexOf(JsValue thisObj, JsValue[] arguments) + private JsValue LastIndexOf(JsValue thisObject, JsValue[] arguments) { var searchElement = arguments.At(0); - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = o.Length; if (len == 0) { @@ -706,9 +706,9 @@ private JsValue LastIndexOf(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.map /// - private ObjectInstance Map(JsValue thisObj, JsValue[] arguments) + private ObjectInstance Map(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = o.Length; var thisArg = arguments.At(1); @@ -732,12 +732,12 @@ private ObjectInstance Map(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce /// - private JsValue Reduce(JsValue thisObj, JsValue[] arguments) + private JsValue Reduce(JsValue thisObject, JsValue[] arguments) { var callbackfn = GetCallable(arguments.At(0)); var initialValue = arguments.At(1); - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = o.Length; if (len == 0 && arguments.Length < 2) @@ -777,12 +777,12 @@ private JsValue Reduce(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright /// - private JsValue ReduceRight(JsValue thisObj, JsValue[] arguments) + private JsValue ReduceRight(JsValue thisObject, JsValue[] arguments) { var callbackfn = GetCallable(arguments.At(0)); var initialValue = arguments.At(1); - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = (int) o.Length; if (len == 0 && arguments.Length < 2) @@ -819,9 +819,9 @@ private JsValue ReduceRight(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse /// - private ObjectInstance Reverse(JsValue thisObj, JsValue[] arguments) + private ObjectInstance Reverse(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = (int) o.Length; var middle = (int) System.Math.Floor(len / 2.0); var lower = 0; @@ -844,9 +844,9 @@ private ObjectInstance Reverse(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.set /// - private JsValue Set(JsValue thisObj, JsValue[] arguments) + private JsValue Set(JsValue thisObject, JsValue[] arguments) { - var target = thisObj as JsTypedArray; + var target = thisObject as JsTypedArray; if (target is null) { ExceptionHelper.ThrowTypeError(_realm); @@ -994,11 +994,11 @@ private void SetTypedArrayFromArrayLike(JsTypedArray target, int targetOffset, J /// /// https://tc39.es/proposal-relative-indexing-method/#sec-%typedarray.prototype%-additions /// - private JsValue At(JsValue thisObj, JsValue[] arguments) + private JsValue At(JsValue thisObject, JsValue[] arguments) { var start = arguments.At(0); - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); long len = o.Length; var relativeStart = TypeConverter.ToInteger(start); @@ -1024,12 +1024,12 @@ private JsValue At(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice /// - private JsValue Slice(JsValue thisObj, JsValue[] arguments) + private JsValue Slice(JsValue thisObject, JsValue[] arguments) { var start = arguments.At(0); var end = arguments.At(1); - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); long len = o.Length; var relativeStart = TypeConverter.ToIntegerOrInfinity(start); @@ -1109,9 +1109,9 @@ private JsValue Slice(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.some /// - private JsValue Some(JsValue thisObj, JsValue[] arguments) + private JsValue Some(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var len = o.Length; var callbackfn = GetCallable(arguments.At(0)); var thisArg = arguments.At(1); @@ -1135,7 +1135,7 @@ private JsValue Some(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort /// - private JsValue Sort(JsValue thisObj, JsValue[] arguments) + private JsValue Sort(JsValue thisObject, JsValue[] arguments) { /* * %TypedArray%.prototype.sort is a distinct function that, except as described below, @@ -1144,7 +1144,7 @@ private JsValue Sort(JsValue thisObj, JsValue[] arguments) * an object that has a fixed length and whose integer-indexed properties are not sparse. */ - var obj = thisObj.ValidateTypedArray(_realm); + var obj = thisObject.ValidateTypedArray(_realm); var buffer = obj._viewedArrayBuffer; var len = obj.Length; @@ -1168,9 +1168,9 @@ private JsValue Sort(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray /// - private JsValue Subarray(JsValue thisObj, JsValue[] arguments) + private JsValue Subarray(JsValue thisObject, JsValue[] arguments) { - var o = thisObj as JsTypedArray; + var o = thisObject as JsTypedArray; if (o is null) { ExceptionHelper.ThrowTypeError(_realm); @@ -1232,7 +1232,7 @@ private JsValue Subarray(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring /// - private JsValue ToLocaleString(JsValue thisObj, JsValue[] arguments) + private JsValue ToLocaleString(JsValue thisObject, JsValue[] arguments) { /* * %TypedArray%.prototype.toLocaleString is a distinct function that implements the same algorithm as Array.prototype.toLocaleString @@ -1242,7 +1242,7 @@ private JsValue ToLocaleString(JsValue thisObj, JsValue[] arguments) * any observable changes in the specified behaviour of the algorithm. */ - var array = thisObj.ValidateTypedArray(_realm); + var array = thisObject.ValidateTypedArray(_realm); var len = array.Length; const string separator = ","; if (len == 0) @@ -1288,18 +1288,18 @@ private JsValue ToLocaleString(JsValue thisObj, JsValue[] arguments) /// /// https://tc39.es/ecma262/#sec-%typedarray%.prototype.values /// - private JsValue Values(JsValue thisObj, JsValue[] arguments) + private JsValue Values(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); return _realm.Intrinsics.ArrayIteratorPrototype.Construct(o, ArrayIteratorType.Value); } /// /// https://tc39.es/ecma262/#sec-get-%typedarray%.prototype-@@tostringtag /// - private static JsValue ToStringTag(JsValue thisObj, JsValue[] arguments) + private static JsValue ToStringTag(JsValue thisObject, JsValue[] arguments) { - if (thisObj is not JsTypedArray o) + if (thisObject is not JsTypedArray o) { return Undefined; } @@ -1307,9 +1307,9 @@ private static JsValue ToStringTag(JsValue thisObj, JsValue[] arguments) return o._arrayElementType.GetTypedArrayName(); } - private JsValue ToReversed(JsValue thisObj, JsValue[] arguments) + private JsValue ToReversed(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var length = o._arrayLength; var a = TypedArrayCreateSameType(o, new [] { JsNumber.Create(length) }); @@ -1323,9 +1323,9 @@ private JsValue ToReversed(JsValue thisObj, JsValue[] arguments) return a; } - private JsValue ToSorted(JsValue thisObj, JsValue[] arguments) + private JsValue ToSorted(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var compareFn = GetCompareFunction(arguments.At(0)); var buffer = o._viewedArrayBuffer; @@ -1342,9 +1342,9 @@ private JsValue ToSorted(JsValue thisObj, JsValue[] arguments) return a; } - private ObjectInstance With(JsValue thisObj, JsValue[] arguments) + private ObjectInstance With(JsValue thisObject, JsValue[] arguments) { - var o = thisObj.ValidateTypedArray(_realm); + var o = thisObject.ValidateTypedArray(_realm); var value = arguments.At(1); var length = o._arrayLength; diff --git a/Jint/Native/TypedArray/TypedArrayConstructor.cs b/Jint/Native/TypedArray/TypedArrayConstructor.cs index 7887c49350..7871980228 100644 --- a/Jint/Native/TypedArray/TypedArrayConstructor.cs +++ b/Jint/Native/TypedArray/TypedArrayConstructor.cs @@ -41,7 +41,7 @@ protected override void Initialize() SetProperties(properties); } - public override ObjectInstance Construct(JsValue[] args, JsValue newTarget) + public override ObjectInstance Construct(JsValue[] arguments, JsValue newTarget) { if (newTarget.IsUndefined()) { @@ -64,13 +64,13 @@ public override ObjectInstance Construct(JsValue[] args, JsValue newTarget) _ => null! }; - var numberOfArgs = args.Length; + var numberOfArgs = arguments.Length; if (numberOfArgs == 0) { return AllocateTypedArray(newTarget, proto, 0); } - var firstArgument = args[0]; + var firstArgument = arguments[0]; if (firstArgument.IsObject()) { var o = AllocateTypedArray(newTarget, proto); @@ -80,8 +80,8 @@ public override ObjectInstance Construct(JsValue[] args, JsValue newTarget) } else if (firstArgument is JsArrayBuffer arrayBuffer) { - var byteOffset = numberOfArgs > 1 ? args[1] : Undefined; - var length = numberOfArgs > 2 ? args[2] : Undefined; + var byteOffset = numberOfArgs > 1 ? arguments[1] : Undefined; + var length = numberOfArgs > 2 ? arguments[2] : Undefined; InitializeTypedArrayFromArrayBuffer(o, arrayBuffer, byteOffset, length); } else diff --git a/Jint/Native/WeakMap/WeakMapPrototype.cs b/Jint/Native/WeakMap/WeakMapPrototype.cs index a4c1fccebd..a73f83c661 100644 --- a/Jint/Native/WeakMap/WeakMapPrototype.cs +++ b/Jint/Native/WeakMap/WeakMapPrototype.cs @@ -45,39 +45,39 @@ protected override void Initialize() SetSymbols(symbols); } - private JsValue Get(JsValue thisObj, JsValue[] arguments) + private JsValue Get(JsValue thisObject, JsValue[] arguments) { - var map = AssertWeakMapInstance(thisObj); + var map = AssertWeakMapInstance(thisObject); return map.WeakMapGet(arguments.At(0)); } - private JsValue Delete(JsValue thisObj, JsValue[] arguments) + private JsValue Delete(JsValue thisObject, JsValue[] arguments) { - var map = AssertWeakMapInstance(thisObj); + var map = AssertWeakMapInstance(thisObject); return arguments.Length > 0 && map.WeakMapDelete(arguments.At(0)) ? JsBoolean.True : JsBoolean.False; } - private JsValue Set(JsValue thisObj, JsValue[] arguments) + private JsValue Set(JsValue thisObject, JsValue[] arguments) { - var map = AssertWeakMapInstance(thisObj); + var map = AssertWeakMapInstance(thisObject); map.WeakMapSet(arguments.At(0), arguments.At(1)); - return thisObj; + return thisObject; } - private JsValue Has(JsValue thisObj, JsValue[] arguments) + private JsValue Has(JsValue thisObject, JsValue[] arguments) { - var map = AssertWeakMapInstance(thisObj); + var map = AssertWeakMapInstance(thisObject); return map.WeakMapHas(arguments.At(0)) ? JsBoolean.True : JsBoolean.False; } - private WeakMapInstance AssertWeakMapInstance(JsValue thisObj) + private WeakMapInstance AssertWeakMapInstance(JsValue thisObject) { - var map = thisObj as WeakMapInstance; - if (map is null) + if (thisObject is WeakMapInstance map) { - ExceptionHelper.ThrowTypeError(_realm, "object must be a WeakMap"); + return map; } - return map; + ExceptionHelper.ThrowTypeError(_realm, "object must be a WeakMap"); + return default; } } diff --git a/Jint/Native/WeakRef/WeakRefPrototype.cs b/Jint/Native/WeakRef/WeakRefPrototype.cs index acd9645fb4..7b1d4c3618 100644 --- a/Jint/Native/WeakRef/WeakRefPrototype.cs +++ b/Jint/Native/WeakRef/WeakRefPrototype.cs @@ -41,9 +41,9 @@ protected override void Initialize() SetSymbols(symbols); } - private JsValue Deref(JsValue thisObj, JsValue[] arguments) + private JsValue Deref(JsValue thisObject, JsValue[] arguments) { - var weakRef = thisObj as WeakRefInstance; + var weakRef = thisObject as WeakRefInstance; if (weakRef is null) { ExceptionHelper.ThrowTypeError(_realm, "object must be a WeakRef"); diff --git a/Jint/Native/WeakSet/WeakSetPrototype.cs b/Jint/Native/WeakSet/WeakSetPrototype.cs index 9b9ec1861e..0bb8612e21 100644 --- a/Jint/Native/WeakSet/WeakSetPrototype.cs +++ b/Jint/Native/WeakSet/WeakSetPrototype.cs @@ -47,33 +47,33 @@ protected override void Initialize() SetSymbols(symbols); } - private JsValue Add(JsValue thisObj, JsValue[] arguments) + private JsValue Add(JsValue thisObject, JsValue[] arguments) { - var set = AssertWeakSetInstance(thisObj); + var set = AssertWeakSetInstance(thisObject); set.WeakSetAdd(arguments.At(0)); - return thisObj; + return thisObject; } - private JsValue Delete(JsValue thisObj, JsValue[] arguments) + private JsValue Delete(JsValue thisObject, JsValue[] arguments) { - var set = AssertWeakSetInstance(thisObj); + var set = AssertWeakSetInstance(thisObject); return set.WeakSetDelete(arguments.At(0)) ? JsBoolean.True : JsBoolean.False; } - private JsValue Has(JsValue thisObj, JsValue[] arguments) + private JsValue Has(JsValue thisObject, JsValue[] arguments) { - var set = AssertWeakSetInstance(thisObj); + var set = AssertWeakSetInstance(thisObject); return set.WeakSetHas(arguments.At(0)) ? JsBoolean.True : JsBoolean.False; } - private WeakSetInstance AssertWeakSetInstance(JsValue thisObj) + private WeakSetInstance AssertWeakSetInstance(JsValue thisObject) { - var set = thisObj as WeakSetInstance; - if (set is null) + if (thisObject is WeakSetInstance set) { - ExceptionHelper.ThrowTypeError(_realm, "object must be a WeakSet"); + return set; } - return set; + ExceptionHelper.ThrowTypeError(_realm, "object must be a WeakSet"); + return default; } } diff --git a/Jint/Runtime/Environments/FunctionEnvironmentRecord.cs b/Jint/Runtime/Environments/FunctionEnvironmentRecord.cs index 9a9d66fcfa..ed5ade0f2f 100644 --- a/Jint/Runtime/Environments/FunctionEnvironmentRecord.cs +++ b/Jint/Runtime/Environments/FunctionEnvironmentRecord.cs @@ -405,7 +405,7 @@ public ArrayPatternProtocol( _max = max; } - protected override void ProcessItem(JsValue[] args, JsValue currentValue) + protected override void ProcessItem(JsValue[] arguments, JsValue currentValue) { _instance.SetIndexValue((uint) _index, currentValue, updateLength: false); _index++; diff --git a/Jint/Runtime/Interop/ObjectWrapper.cs b/Jint/Runtime/Interop/ObjectWrapper.cs index 9afd608962..f6f5ad67cb 100644 --- a/Jint/Runtime/Interop/ObjectWrapper.cs +++ b/Jint/Runtime/Interop/ObjectWrapper.cs @@ -259,18 +259,18 @@ public static PropertyDescriptor GetPropertyDescriptor(Engine engine, object tar return engine.Options.Interop.TypeResolver.GetAccessor(engine, target.GetType(), member.Name, Factory).CreatePropertyDescriptor(engine, target); } - private static JsValue Iterator(JsValue thisObj, JsValue[] arguments) + private static JsValue Iterator(JsValue thisObject, JsValue[] arguments) { - var wrapper = (ObjectWrapper) thisObj; + var wrapper = (ObjectWrapper) thisObject; return wrapper._typeDescriptor.IsDictionary ? new DictionaryIterator(wrapper._engine, wrapper) : new EnumerableIterator(wrapper._engine, (IEnumerable) wrapper.Target); } - private static JsValue GetLength(JsValue thisObj, JsValue[] arguments) + private static JsValue GetLength(JsValue thisObject, JsValue[] arguments) { - var wrapper = (ObjectWrapper) thisObj; + var wrapper = (ObjectWrapper) thisObject; return JsNumber.Create((int) (wrapper._typeDescriptor.LengthProperty?.GetValue(wrapper.Target) ?? 0)); } diff --git a/Jint/Runtime/Interpreter/Expressions/JintArrayExpression.cs b/Jint/Runtime/Interpreter/Expressions/JintArrayExpression.cs index 010c89e6c6..0a67535406 100644 --- a/Jint/Runtime/Interpreter/Expressions/JintArrayExpression.cs +++ b/Jint/Runtime/Interpreter/Expressions/JintArrayExpression.cs @@ -103,7 +103,7 @@ public ArraySpreadProtocol( _index = startIndex - 1; } - protected override void ProcessItem(JsValue[] args, JsValue currentValue) + protected override void ProcessItem(JsValue[] arguments, JsValue currentValue) { _index++; _addedCount++; diff --git a/Jint/Runtime/Interpreter/Expressions/JintExpression.cs b/Jint/Runtime/Interpreter/Expressions/JintExpression.cs index 437100fe56..51e42f766a 100644 --- a/Jint/Runtime/Interpreter/Expressions/JintExpression.cs +++ b/Jint/Runtime/Interpreter/Expressions/JintExpression.cs @@ -477,7 +477,7 @@ public ArraySpreadProtocol( _instance = instance; } - protected override void ProcessItem(JsValue[] args, JsValue currentValue) + protected override void ProcessItem(JsValue[] arguments, JsValue currentValue) { _instance.Add(currentValue); } diff --git a/Jint/Runtime/Modules/CyclicModuleRecord.cs b/Jint/Runtime/Modules/CyclicModuleRecord.cs index e963b4c778..9bf7593a5d 100644 --- a/Jint/Runtime/Modules/CyclicModuleRecord.cs +++ b/Jint/Runtime/Modules/CyclicModuleRecord.cs @@ -435,7 +435,7 @@ private Completion ExecuteAsyncModule() /// /// https://tc39.es/ecma262/#sec-async-module-execution-fulfilled /// - private JsValue AsyncModuleExecutionFulfilled(JsValue thisObj, JsValue[] arguments) + private JsValue AsyncModuleExecutionFulfilled(JsValue thisObject, JsValue[] arguments) { var module = (CyclicModuleRecord) arguments.At(0); if (module.Status == ModuleStatus.Evaluated) @@ -509,7 +509,7 @@ private JsValue AsyncModuleExecutionFulfilled(JsValue thisObj, JsValue[] argumen /// /// https://tc39.es/ecma262/#sec-async-module-execution-rejected /// - private static JsValue AsyncModuleExecutionRejected(JsValue thisObj, JsValue[] arguments) + private static JsValue AsyncModuleExecutionRejected(JsValue thisObject, JsValue[] arguments) { var module = (SourceTextModuleRecord) arguments.At(0); var error = arguments.At(1); @@ -538,7 +538,7 @@ private static JsValue AsyncModuleExecutionRejected(JsValue thisObj, JsValue[] a for (var i = 0; i < asyncParentModules.Count; i++) { var m = asyncParentModules[i]; - AsyncModuleExecutionRejected(thisObj, new[] { m, error }); + AsyncModuleExecutionRejected(thisObject, new[] { m, error }); } if (module._topLevelCapability is not null)