Browse Source

Enforce code style on build and fix issues (#2074)

Marko Lahma 4 months ago
parent
commit
323230e2fb
66 changed files with 286 additions and 277 deletions
  1. 5 5
      Jint/Collections/DictionarySlim.cs
  2. 4 4
      Jint/Collections/StringDictionarySlim.cs
  3. 1 1
      Jint/Engine.Modules.cs
  4. 2 2
      Jint/Engine.cs
  5. 1 1
      Jint/Extensions/Character.cs
  6. 5 5
      Jint/Extensions/Hash.cs
  7. 33 33
      Jint/Extensions/WebEncoders.cs
  8. 2 2
      Jint/HoistingScope.cs
  9. 1 1
      Jint/Jint.csproj
  10. 3 3
      Jint/Native/Array/ArrayConstructor.cs
  11. 1 1
      Jint/Native/Array/ArrayIteratorPrototype.cs
  12. 2 2
      Jint/Native/Array/ArrayOperations.cs
  13. 8 6
      Jint/Native/Array/ArrayPrototype.cs
  14. 1 1
      Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs
  15. 1 1
      Jint/Native/Date/DateConstructor.cs
  16. 15 15
      Jint/Native/Date/DatePrototype.cs
  17. 5 1
      Jint/Native/Function/FunctionInstance.Dynamic.cs
  18. 9 9
      Jint/Native/Global/GlobalObject.cs
  19. 1 1
      Jint/Native/Intl/IntlInstance.cs
  20. 5 5
      Jint/Native/JsArrayBuffer.cs
  21. 1 1
      Jint/Native/JsNumber.cs
  22. 1 1
      Jint/Native/JsString.cs
  23. 10 10
      Jint/Native/JsValue.cs
  24. 1 1
      Jint/Native/JsWeakMap.cs
  25. 26 26
      Jint/Native/Json/JsonSerializer.cs
  26. 19 19
      Jint/Native/Math/MathInstance.cs
  27. 4 4
      Jint/Native/Number/Dtoa/BignumDtoa.cs
  28. 1 1
      Jint/Native/Number/Dtoa/CachePowers.cs
  29. 4 4
      Jint/Native/Number/Dtoa/DiyFp.cs
  30. 3 2
      Jint/Native/Number/Dtoa/DtoaNumberFormatter.cs
  31. 14 13
      Jint/Native/Number/Dtoa/FastDtoa.cs
  32. 1 1
      Jint/Native/Number/Dtoa/NumberExtensions.cs
  33. 4 4
      Jint/Native/Number/NumberPrototype.cs
  34. 2 2
      Jint/Native/Object/ObjectConstructor.cs
  35. 1 1
      Jint/Native/Object/ObjectPrototype.cs
  36. 1 1
      Jint/Native/Promise/PromiseConstructor.cs
  37. 2 2
      Jint/Native/SharedArrayBuffer/SharedArrayBufferConstructor.cs
  38. 3 3
      Jint/Native/String/StringConstructor.cs
  39. 4 4
      Jint/Native/String/StringPrototype.cs
  40. 4 3
      Jint/Native/Symbol/SymbolPrototype.cs
  41. 2 2
      Jint/Native/TypedArray/IntrinsicTypedArrayPrototype.cs
  42. 1 1
      Jint/Native/TypedArray/TypedArrayConstructor.cs
  43. 5 5
      Jint/Native/TypedArray/Uint8ArrayPrototype.cs
  44. 1 1
      Jint/Native/WeakMap/WeakMapConstructor.cs
  45. 6 6
      Jint/Pooling/ValueStringBuilder.cs
  46. 1 1
      Jint/Runtime/CallStack/CallStackElementComparer.cs
  47. 1 1
      Jint/Runtime/DefaultTimeSystem.cs
  48. 1 1
      Jint/Runtime/Environments/DeclarativeEnvironment.cs
  49. 1 1
      Jint/Runtime/Environments/FunctionEnvironment.cs
  50. 1 1
      Jint/Runtime/ITimeSystem.cs
  51. 24 24
      Jint/Runtime/Interop/DefaultObjectConverter.cs
  52. 11 11
      Jint/Runtime/Interop/DelegateWrapper.cs
  53. 1 1
      Jint/Runtime/Interop/GetterFunction.cs
  54. 2 2
      Jint/Runtime/Interop/ObjectWrapper.cs
  55. 1 1
      Jint/Runtime/Interop/Reflection/IndexerAccessor.cs
  56. 1 1
      Jint/Runtime/Interop/TypeReference.cs
  57. 2 2
      Jint/Runtime/Interop/TypeResolver.cs
  58. 1 1
      Jint/Runtime/Interpreter/DeclarationCache.cs
  59. 1 1
      Jint/Runtime/Interpreter/Expressions/DestructuringPatternAssignmentExpression.cs
  60. 4 4
      Jint/Runtime/Interpreter/Expressions/JintBinaryExpression.cs
  61. 1 1
      Jint/Runtime/Interpreter/Expressions/JintSequenceExpression.cs
  62. 1 1
      Jint/Runtime/Interpreter/JintFunctionDefinition.cs
  63. 1 1
      Jint/Runtime/Interpreter/Statements/ConstantReturnStatement.cs
  64. 1 1
      Jint/Runtime/Interpreter/Statements/JintSwitchBlock.cs
  65. 1 1
      Jint/Runtime/OrderedSet.cs
  66. 2 2
      Jint/Runtime/TypeConverter.cs

+ 5 - 5
Jint/Collections/DictionarySlim.cs

@@ -75,8 +75,8 @@ internal sealed class DictionarySlim<TKey, TValue> : IReadOnlyCollection<KeyValu
     public bool ContainsKey(TKey key)
     public bool ContainsKey(TKey key)
     {
     {
         Entry[] entries = _entries;
         Entry[] entries = _entries;
-        for (int i = _buckets[key.GetHashCode() & (_buckets.Length-1)] - 1;
-             (uint)i < (uint)entries.Length; i = entries[i].next)
+        for (int i = _buckets[key.GetHashCode() & (_buckets.Length - 1)] - 1;
+             (uint) i < (uint) entries.Length; i = entries[i].next)
         {
         {
             if (key.Equals(entries[i].key))
             if (key.Equals(entries[i].key))
                 return true;
                 return true;
@@ -89,7 +89,7 @@ internal sealed class DictionarySlim<TKey, TValue> : IReadOnlyCollection<KeyValu
     {
     {
         Entry[] entries = _entries;
         Entry[] entries = _entries;
         for (int i = _buckets[key.GetHashCode() & (_buckets.Length - 1)] - 1;
         for (int i = _buckets[key.GetHashCode() & (_buckets.Length - 1)] - 1;
-             (uint)i < (uint)entries.Length; i = entries[i].next)
+             (uint) i < (uint) entries.Length; i = entries[i].next)
         {
         {
             if (key.Equals(entries[i].key))
             if (key.Equals(entries[i].key))
             {
             {
@@ -152,7 +152,7 @@ internal sealed class DictionarySlim<TKey, TValue> : IReadOnlyCollection<KeyValu
         Entry[] entries = _entries;
         Entry[] entries = _entries;
         int bucketIndex = key.GetHashCode() & (_buckets.Length - 1);
         int bucketIndex = key.GetHashCode() & (_buckets.Length - 1);
         for (int i = _buckets[bucketIndex] - 1;
         for (int i = _buckets[bucketIndex] - 1;
-             (uint)i < (uint)entries.Length; i = entries[i].next)
+             (uint) i < (uint) entries.Length; i = entries[i].next)
         {
         {
             if (key.Equals(entries[i].key))
             if (key.Equals(entries[i].key))
                 return ref entries[i].value;
                 return ref entries[i].value;
@@ -200,7 +200,7 @@ internal sealed class DictionarySlim<TKey, TValue> : IReadOnlyCollection<KeyValu
         Debug.Assert(_entries.Length == _count || _entries.Length == 1); // We only copy _count, so if it's longer we will miss some
         Debug.Assert(_entries.Length == _count || _entries.Length == 1); // We only copy _count, so if it's longer we will miss some
         int count = _count;
         int count = _count;
         int newSize = _entries.Length * 2;
         int newSize = _entries.Length * 2;
-        if ((uint)newSize > (uint)int.MaxValue) // uint cast handles overflow
+        if ((uint) newSize > int.MaxValue) // uint cast handles overflow
             throw new InvalidOperationException("Capacity Overflow");
             throw new InvalidOperationException("Capacity Overflow");
 
 
         var entries = new Entry[newSize];
         var entries = new Entry[newSize];

+ 4 - 4
Jint/Collections/StringDictionarySlim.cs

@@ -127,7 +127,7 @@ internal sealed class StringDictionarySlim<TValue> : DictionaryBase<TValue>, IRe
         Entry[] entries = _entries;
         Entry[] entries = _entries;
         int bucketIndex = key.HashCode & (_buckets.Length - 1);
         int bucketIndex = key.HashCode & (_buckets.Length - 1);
         for (int i = _buckets[bucketIndex] - 1;
         for (int i = _buckets[bucketIndex] - 1;
-             (uint)i < (uint)entries.Length; i = entries[i].next)
+             (uint) i < (uint) entries.Length; i = entries[i].next)
         {
         {
             if (key.Name == entries[i].key.Name)
             if (key.Name == entries[i].key.Name)
             {
             {
@@ -154,7 +154,7 @@ internal sealed class StringDictionarySlim<TValue> : DictionaryBase<TValue>, IRe
         Entry[] entries = _entries;
         Entry[] entries = _entries;
         int bucketIndex = key.HashCode & (_buckets.Length - 1);
         int bucketIndex = key.HashCode & (_buckets.Length - 1);
         for (int i = _buckets[bucketIndex] - 1;
         for (int i = _buckets[bucketIndex] - 1;
-             (uint)i < (uint)entries.Length; i = entries[i].next)
+             (uint) i < (uint) entries.Length; i = entries[i].next)
         {
         {
             if (key.Name == entries[i].key.Name)
             if (key.Name == entries[i].key.Name)
             {
             {
@@ -172,7 +172,7 @@ internal sealed class StringDictionarySlim<TValue> : DictionaryBase<TValue>, IRe
         Entry[] entries = _entries;
         Entry[] entries = _entries;
         int bucketIndex = key.HashCode & (_buckets.Length - 1);
         int bucketIndex = key.HashCode & (_buckets.Length - 1);
         for (int i = _buckets[bucketIndex] - 1;
         for (int i = _buckets[bucketIndex] - 1;
-             (uint)i < (uint)entries.Length; i = entries[i].next)
+             (uint) i < (uint) entries.Length; i = entries[i].next)
         {
         {
             if (key.Name == entries[i].key.Name)
             if (key.Name == entries[i].key.Name)
             {
             {
@@ -226,7 +226,7 @@ internal sealed class StringDictionarySlim<TValue> : DictionaryBase<TValue>, IRe
         Debug.Assert(_entries.Length == _count || _entries.Length == 1); // We only copy _count, so if it's longer we will miss some
         Debug.Assert(_entries.Length == _count || _entries.Length == 1); // We only copy _count, so if it's longer we will miss some
         int count = _count;
         int count = _count;
         int newSize = _entries.Length * 2;
         int newSize = _entries.Length * 2;
-        if ((uint)newSize > (uint)int.MaxValue) // uint cast handles overflow
+        if ((uint) newSize > int.MaxValue) // uint cast handles overflow
             throw new InvalidOperationException("Capacity Overflow");
             throw new InvalidOperationException("Capacity Overflow");
 
 
         var entries = new Entry[newSize];
         var entries = new Entry[newSize];

+ 1 - 1
Jint/Engine.Modules.cs

@@ -148,7 +148,7 @@ public partial class Engine
         private JsValue EvaluateModule(string specifier, Module module)
         private JsValue EvaluateModule(string specifier, Module module)
         {
         {
             var ownsContext = _engine._activeEvaluationContext is null;
             var ownsContext = _engine._activeEvaluationContext is null;
-            _engine. _activeEvaluationContext ??= new EvaluationContext(_engine);
+            _engine._activeEvaluationContext ??= new EvaluationContext(_engine);
             JsValue evaluationResult;
             JsValue evaluationResult;
             try
             try
             {
             {

+ 2 - 2
Jint/Engine.cs

@@ -52,7 +52,7 @@ public sealed partial class Engine : IDisposable
     internal readonly bool _isDebugMode;
     internal readonly bool _isDebugMode;
     internal readonly bool _isStrict;
     internal readonly bool _isStrict;
 
 
-    private bool _customResolver;
+    private readonly bool _customResolver;
     internal readonly IReferenceResolver _referenceResolver;
     internal readonly IReferenceResolver _referenceResolver;
 
 
     internal readonly ReferencePool _referencePool;
     internal readonly ReferencePool _referencePool;
@@ -1608,7 +1608,7 @@ public sealed partial class Engine : IDisposable
         }
         }
 
 
 #if SUPPORTS_WEAK_TABLE_CLEAR
 #if SUPPORTS_WEAK_TABLE_CLEAR
-            _objectWrapperCache.Clear();
+        _objectWrapperCache.Clear();
 #else
 #else
         // we can expect that reflection is OK as we've been generating object wrappers already
         // we can expect that reflection is OK as we've been generating object wrappers already
         var clearMethod = _objectWrapperCache.GetType().GetMethod("Clear", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
         var clearMethod = _objectWrapperCache.GetType().GetMethod("Clear", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);

+ 1 - 1
Jint/Extensions/Character.cs

@@ -10,7 +10,7 @@ internal static class Character
     public const string AsciiWordCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
     public const string AsciiWordCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
 
 
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
-    public static bool IsInRange(this char c, ushort min, ushort max) => (uint)(c - min) <= (uint)(max - min);
+    public static bool IsInRange(this char c, ushort min, ushort max) => (uint) (c - min) <= (uint) (max - min);
 
 
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     public static bool IsOctalDigit(this char c) => c.IsInRange('0', '7');
     public static bool IsOctalDigit(this char c) => c.IsInRange('0', '7');

+ 5 - 5
Jint/Extensions/Hash.cs

@@ -15,7 +15,7 @@ internal static class Hash
     /// The offset bias value used in the FNV-1a algorithm
     /// The offset bias value used in the FNV-1a algorithm
     /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
     /// See http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
     /// </summary>
     /// </summary>
-    private const int FnvOffsetBias = unchecked((int)2166136261);
+    private const int FnvOffsetBias = unchecked((int) 2166136261);
 
 
     /// <summary>
     /// <summary>
     /// The generative factor used in the FNV-1a algorithm
     /// The generative factor used in the FNV-1a algorithm
@@ -53,10 +53,10 @@ internal static class Hash
         int hashCode = FnvOffsetBias;
         int hashCode = FnvOffsetBias;
 
 
 #if NETCOREAPP3_1_OR_GREATER
 #if NETCOREAPP3_1_OR_GREATER
-            foreach (var chunk in text.GetChunks())
-            {
-                hashCode = CombineFNVHash(hashCode, chunk.Span);
-            }
+        foreach (var chunk in text.GetChunks())
+        {
+            hashCode = CombineFNVHash(hashCode, chunk.Span);
+        }
 #else
 #else
         // StringBuilder.GetChunks is not available in this target framework. Since there is no other direct access
         // StringBuilder.GetChunks is not available in this target framework. Since there is no other direct access
         // to the underlying storage spans of StringBuilder, we fall back to using slower per-character operations.
         // to the underlying storage spans of StringBuilder, we fall back to using slower per-character operations.

+ 33 - 33
Jint/Extensions/WebEncoders.cs

@@ -136,16 +136,16 @@ internal static class WebEncoders
 #if NETCOREAPP
 #if NETCOREAPP
         return Base64UrlEncode(input.AsSpan(offset, count), omitPadding);
         return Base64UrlEncode(input.AsSpan(offset, count), omitPadding);
 #else
 #else
-            // Special-case empty input
-            if (count == 0)
-            {
-                return string.Empty;
-            }
+        // Special-case empty input
+        if (count == 0)
+        {
+            return string.Empty;
+        }
 
 
-            var buffer = new char[GetArraySizeRequiredToEncode(count)];
-            var numBase64Chars = Base64UrlEncode(input, offset, buffer, outputOffset: 0, count: count, omitPadding);
+        var buffer = new char[GetArraySizeRequiredToEncode(count)];
+        var numBase64Chars = Base64UrlEncode(input, offset, buffer, outputOffset: 0, count: count, omitPadding);
 
 
-            return new string(buffer, startIndex: 0, length: numBase64Chars);
+        return new string(buffer, startIndex: 0, length: numBase64Chars);
 #endif
 #endif
     }
     }
 
 
@@ -193,37 +193,37 @@ internal static class WebEncoders
 #if NETCOREAPP
 #if NETCOREAPP
         return Base64UrlEncode(input.AsSpan(offset, count), output.AsSpan(outputOffset), omitPadding);
         return Base64UrlEncode(input.AsSpan(offset, count), output.AsSpan(outputOffset), omitPadding);
 #else
 #else
-            // Special-case empty input.
-            if (count == 0)
-            {
-                return 0;
-            }
+        // Special-case empty input.
+        if (count == 0)
+        {
+            return 0;
+        }
 
 
-            // Use base64url encoding with no padding characters. See RFC 4648, Sec. 5.
+        // Use base64url encoding with no padding characters. See RFC 4648, Sec. 5.
 
 
-            // Start with default Base64 encoding.
-            var numBase64Chars = Convert.ToBase64CharArray(input, offset, count, output, outputOffset);
+        // Start with default Base64 encoding.
+        var numBase64Chars = Convert.ToBase64CharArray(input, offset, count, output, outputOffset);
 
 
-            // Fix up '+' -> '-' and '/' -> '_'. Drop padding characters.
-            for (var i = outputOffset; i - outputOffset < numBase64Chars; i++)
+        // Fix up '+' -> '-' and '/' -> '_'. Drop padding characters.
+        for (var i = outputOffset; i - outputOffset < numBase64Chars; i++)
+        {
+            var ch = output[i];
+            if (ch == '+')
+            {
+                output[i] = '-';
+            }
+            else if (ch == '/')
             {
             {
-                var ch = output[i];
-                if (ch == '+')
-                {
-                    output[i] = '-';
-                }
-                else if (ch == '/')
-                {
-                    output[i] = '_';
-                }
-                else if (omitPadding && ch == '=')
-                {
-                    // We've reached a padding character; truncate the remainder.
-                    return i - outputOffset;
-                }
+                output[i] = '_';
             }
             }
+            else if (omitPadding && ch == '=')
+            {
+                // We've reached a padding character; truncate the remainder.
+                return i - outputOffset;
+            }
+        }
 
 
-            return numBase64Chars;
+        return numBase64Chars;
 #endif
 #endif
     }
     }
 
 

+ 2 - 2
Jint/HoistingScope.cs

@@ -174,7 +174,7 @@ internal sealed class HoistingScope
                 var childType = childNode.Type;
                 var childType = childNode.Type;
                 if (childType == NodeType.VariableDeclaration)
                 if (childType == NodeType.VariableDeclaration)
                 {
                 {
-                    var variableDeclaration = (VariableDeclaration)childNode;
+                    var variableDeclaration = (VariableDeclaration) childNode;
                     if (variableDeclaration.Kind == VariableDeclarationKind.Var)
                     if (variableDeclaration.Kind == VariableDeclarationKind.Var)
                     {
                     {
                         _variableDeclarations ??= [];
                         _variableDeclarations ??= [];
@@ -217,7 +217,7 @@ internal sealed class HoistingScope
                     if (parent is null || (node.Type != NodeType.BlockStatement && node.Type != NodeType.SwitchCase))
                     if (parent is null || (node.Type != NodeType.BlockStatement && node.Type != NodeType.SwitchCase))
                     {
                     {
                         _functions ??= [];
                         _functions ??= [];
-                        _functions.Add((FunctionDeclaration)childNode);
+                        _functions.Add((FunctionDeclaration) childNode);
                     }
                     }
                 }
                 }
                 else if (childType == NodeType.ClassDeclaration && parent is null or AstModule)
                 else if (childType == NodeType.ClassDeclaration && parent is null or AstModule)

+ 1 - 1
Jint/Jint.csproj

@@ -12,7 +12,7 @@
 
 
     <EnableNETAnalyzers>true</EnableNETAnalyzers>
     <EnableNETAnalyzers>true</EnableNETAnalyzers>
     <AnalysisLevel>latest-Recommended</AnalysisLevel>
     <AnalysisLevel>latest-Recommended</AnalysisLevel>
-    <EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
+    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
 
 
     <GenerateDocumentationFile>true</GenerateDocumentationFile>
     <GenerateDocumentationFile>true</GenerateDocumentationFile>
     <PackageReadmeFile>README.md</PackageReadmeFile>
     <PackageReadmeFile>README.md</PackageReadmeFile>

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

@@ -42,7 +42,7 @@ public sealed class ArrayConstructor : Constructor
 
 
         var symbols = new SymbolDictionary(1)
         var symbols = new SymbolDictionary(1)
         {
         {
-            [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunction(Engine, "get [Symbol.species]", Species, 0, PropertyFlag.Configurable), set: Undefined,PropertyFlag.Configurable),
+            [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunction(Engine, "get [Symbol.species]", Species, 0, PropertyFlag.Configurable), set: Undefined, PropertyFlag.Configurable),
         };
         };
         SetSymbols(symbols);
         SetSymbols(symbols);
     }
     }
@@ -202,7 +202,7 @@ public sealed class ArrayConstructor : Constructor
             // faster for real arrays
             // faster for real arrays
             for (uint k = 0; k < arguments.Length; k++)
             for (uint k = 0; k < arguments.Length; k++)
             {
             {
-                var kValue = arguments[(int)k];
+                var kValue = arguments[(int) k];
                 ai.SetIndexValue(k, kValue, updateLength: k == arguments.Length - 1);
                 ai.SetIndexValue(k, kValue, updateLength: k == arguments.Length - 1);
             }
             }
         }
         }
@@ -211,7 +211,7 @@ public sealed class ArrayConstructor : Constructor
             // slower version
             // slower version
             for (uint k = 0; k < arguments.Length; k++)
             for (uint k = 0; k < arguments.Length; k++)
             {
             {
-                var kValue = arguments[(int)k];
+                var kValue = arguments[(int) k];
                 var key = JsString.Create(k);
                 var key = JsString.Create(k);
                 a.CreateDataPropertyOrThrow(key, kValue);
                 a.CreateDataPropertyOrThrow(key, kValue);
             }
             }

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

@@ -47,7 +47,7 @@ internal sealed class ArrayIteratorPrototype : IteratorPrototype
         }
         }
 
 
         IteratorInstance instance = array is JsArray jsArray
         IteratorInstance instance = array is JsArray jsArray
-            ? new ArrayIterator(Engine, jsArray, kind)  { _prototype = this }
+            ? new ArrayIterator(Engine, jsArray, kind) { _prototype = this }
             : new ArrayLikeIterator(Engine, array, kind) { _prototype = this };
             : new ArrayLikeIterator(Engine, array, kind) { _prototype = this };
 
 
         return instance;
         return instance;

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

@@ -602,7 +602,7 @@ internal abstract class ArrayOperations : IEnumerable<JsValue>
 
 
         public override void EnsureCapacity(ulong capacity)
         public override void EnsureCapacity(ulong capacity)
         {
         {
-            _target.EnsureCapacity((int)capacity);
+            _target.EnsureCapacity((int) capacity);
         }
         }
 
 
         public override JsValue Get(ulong index) => index < (ulong) _target.Length ? ReadValue((int) index) : JsValue.Undefined;
         public override JsValue Get(ulong index) => index < (ulong) _target.Length ? ReadValue((int) index) : JsValue.Undefined;
@@ -631,7 +631,7 @@ internal abstract class ArrayOperations : IEnumerable<JsValue>
 
 
         public override void Set(ulong index, JsValue value, bool updateLength = false, bool throwOnError = true)
         public override void Set(ulong index, JsValue value, bool updateLength = false, bool throwOnError = true)
         {
         {
-            _target.SetAt((int)index, value);
+            _target.SetAt((int) index, value);
         }
         }
 
 
         public override void DeletePropertyOrThrow(ulong index)
         public override void DeletePropertyOrThrow(ulong index)

+ 8 - 6
Jint/Native/Array/ArrayPrototype.cs

@@ -69,7 +69,7 @@ public sealed class ArrayPrototype : ArrayInstance
             ["reduce"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "reduce", prototype.Reduce, 1, PropertyFlag.Configurable), PropertyFlags),
             ["reduce"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "reduce", prototype.Reduce, 1, PropertyFlag.Configurable), PropertyFlags),
             ["reduceRight"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "reduceRight", prototype.ReduceRight, 1, PropertyFlag.Configurable), PropertyFlags),
             ["reduceRight"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "reduceRight", prototype.ReduceRight, 1, PropertyFlag.Configurable), PropertyFlags),
             ["reverse"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "reverse", prototype.Reverse, 0, PropertyFlag.Configurable), PropertyFlags),
             ["reverse"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "reverse", prototype.Reverse, 0, PropertyFlag.Configurable), PropertyFlags),
-            ["shift"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "shift",prototype. Shift, 0, PropertyFlag.Configurable), PropertyFlags),
+            ["shift"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "shift", prototype.Shift, 0, PropertyFlag.Configurable), PropertyFlags),
             ["slice"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "slice", prototype.Slice, 2, PropertyFlag.Configurable), PropertyFlags),
             ["slice"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "slice", prototype.Slice, 2, PropertyFlag.Configurable), PropertyFlags),
             ["some"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "some", prototype.Some, 1, PropertyFlag.Configurable), PropertyFlags),
             ["some"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "some", prototype.Some, 1, PropertyFlag.Configurable), PropertyFlags),
             ["sort"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "sort", prototype.Sort, 1, PropertyFlag.Configurable), PropertyFlags),
             ["sort"] = new LazyPropertyDescriptor<ArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "sort", prototype.Sort, 1, PropertyFlag.Configurable), PropertyFlags),
@@ -1093,11 +1093,13 @@ public sealed class ArrayPrototype : ArrayInstance
                 ordered = items.OrderBy(x => x, comparer);
                 ordered = items.OrderBy(x => x, comparer);
             }
             }
 #else
 #else
-    #if NET8_0_OR_GREATER
-                ordered = items.Order(comparer);
-    #else
-                ordered = items.OrderBy(x => x, comparer);
-    #endif
+
+#if NET8_0_OR_GREATER
+            ordered = items.Order(comparer);
+#else
+            ordered = items.OrderBy(x => x, comparer);
+#endif
+
 #endif
 #endif
             uint j = 0;
             uint j = 0;
             foreach (var item in ordered)
             foreach (var item in ordered)

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

@@ -40,7 +40,7 @@ public sealed class ArrayBufferConstructor : Constructor
 
 
         var symbols = new SymbolDictionary(1)
         var symbols = new SymbolDictionary(1)
         {
         {
-            [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunction(Engine, "get [Symbol.species]", Species, 0, lengthFlags), set: Undefined,PropertyFlag.Configurable),
+            [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunction(Engine, "get [Symbol.species]", Species, 0, lengthFlags), set: Undefined, PropertyFlag.Configurable),
         };
         };
         SetSymbols(symbols);
         SetSymbols(symbols);
     }
     }

+ 1 - 1
Jint/Native/Date/DateConstructor.cs

@@ -87,7 +87,7 @@ internal sealed class DateConstructor : Constructor
         var yInteger = TypeConverter.ToInteger(y);
         var yInteger = TypeConverter.ToInteger(y);
         if (!double.IsNaN(y) && 0 <= yInteger && yInteger <= 99)
         if (!double.IsNaN(y) && 0 <= yInteger && yInteger <= 99)
         {
         {
-            y  = yInteger + 1900;
+            y = yInteger + 1900;
         }
         }
 
 
         var finalDate = DatePrototype.MakeDate(
         var finalDate = DatePrototype.MakeDate(

+ 15 - 15
Jint/Native/Date/DatePrototype.cs

@@ -36,7 +36,7 @@ internal sealed class DatePrototype : Prototype
         _timeSystem = engine.Options.TimeSystem;
         _timeSystem = engine.Options.TimeSystem;
     }
     }
 
 
-    protected override  void Initialize()
+    protected override void Initialize()
     {
     {
         const PropertyFlag lengthFlags = PropertyFlag.Configurable;
         const PropertyFlag lengthFlags = PropertyFlag.Configurable;
         const PropertyFlag propertyFlags = PropertyFlag.Configurable | PropertyFlag.Writable;
         const PropertyFlag propertyFlags = PropertyFlag.Configurable | PropertyFlag.Writable;
@@ -122,7 +122,7 @@ internal sealed class DatePrototype : Prototype
         {
         {
             tryFirst = Types.String;
             tryFirst = Types.String;
         }
         }
-        else  if (string.Equals(hintString, "number", StringComparison.Ordinal))
+        else if (string.Equals(hintString, "number", StringComparison.Ordinal))
         {
         {
             tryFirst = Types.Number;
             tryFirst = Types.Number;
         }
         }
@@ -447,7 +447,7 @@ internal sealed class DatePrototype : Prototype
         {
         {
             return JsNumber.DoubleNaN;
             return JsNumber.DoubleNaN;
         }
         }
-        return (int) ((double) t.Value - LocalTime(t).Value)/MsPerMinute;
+        return (int) ((double) t.Value - LocalTime(t).Value) / MsPerMinute;
     }
     }
 
 
     /// <summary>
     /// <summary>
@@ -873,22 +873,22 @@ internal sealed class DatePrototype : Prototype
     /// </summary>
     /// </summary>
     private static int DaysInYear(double y)
     private static int DaysInYear(double y)
     {
     {
-        if (y%4 != 0)
+        if (y % 4 != 0)
         {
         {
             return 365;
             return 365;
         }
         }
 
 
-        if (y%4 == 0 && y%100 != 0)
+        if (y % 4 == 0 && y % 100 != 0)
         {
         {
             return 366;
             return 366;
         }
         }
 
 
-        if (y%100 == 0 && y%400 != 0)
+        if (y % 100 == 0 && y % 400 != 0)
         {
         {
             return 365;
             return 365;
         }
         }
 
 
-        if (y%400 == 0)
+        if (y % 400 == 0)
         {
         {
             return 366;
             return 366;
         }
         }
@@ -901,10 +901,10 @@ internal sealed class DatePrototype : Prototype
     /// </summary>
     /// </summary>
     private static int DayFromYear(DatePresentation y)
     private static int DayFromYear(DatePresentation y)
     {
     {
-        return (int) (365*(y.Value - 1970)
-                      + System.Math.Floor((y.Value - 1969)/4d)
-                      - System.Math.Floor((y.Value - 1901)/100d)
-                      + System.Math.Floor((y.Value - 1601)/400d));
+        return (int) (365 * (y.Value - 1970)
+                      + System.Math.Floor((y.Value - 1969) / 4d)
+                      - System.Math.Floor((y.Value - 1901) / 100d)
+                      + System.Math.Floor((y.Value - 1601) / 400d));
     }
     }
 
 
     /// <summary>
     /// <summary>
@@ -912,7 +912,7 @@ internal sealed class DatePrototype : Prototype
     /// </summary>
     /// </summary>
     private static long TimeFromYear(DatePresentation y)
     private static long TimeFromYear(DatePresentation y)
     {
     {
-        return MsPerDay*DayFromYear(y);
+        return MsPerDay * DayFromYear(y);
     }
     }
 
 
     /// <summary>
     /// <summary>
@@ -1032,7 +1032,7 @@ internal sealed class DatePrototype : Prototype
             return dayWithinYear + 1;
             return dayWithinYear + 1;
         }
         }
 
 
-        if (monthFromTime== 1)
+        if (monthFromTime == 1)
         {
         {
             return dayWithinYear - 30;
             return dayWithinYear - 30;
         }
         }
@@ -1185,7 +1185,7 @@ internal sealed class DatePrototype : Prototype
         var m = TypeConverter.ToInteger(min);
         var m = TypeConverter.ToInteger(min);
         var s = TypeConverter.ToInteger(sec);
         var s = TypeConverter.ToInteger(sec);
         var milli = TypeConverter.ToInteger(ms);
         var milli = TypeConverter.ToInteger(ms);
-        var t = h*MsPerHour + m*MsPerMinute + s*MsPerSecond + milli;
+        var t = h * MsPerHour + m * MsPerMinute + s * MsPerSecond + milli;
 
 
         return t;
         return t;
     }
     }
@@ -1262,7 +1262,7 @@ internal sealed class DatePrototype : Prototype
         => IsFinite(value1) && IsFinite(value2) && IsFinite(value3);
         => IsFinite(value1) && IsFinite(value2) && IsFinite(value3);
 
 
     private static bool AreFinite(double value1, double value2, double value3, double value4)
     private static bool AreFinite(double value1, double value2, double value3, double value4)
-        => IsFinite(value1) && IsFinite(value2) &&  IsFinite(value3) && IsFinite(value4);
+        => IsFinite(value1) && IsFinite(value2) && IsFinite(value3) && IsFinite(value4);
 
 
     [StructLayout(LayoutKind.Auto)]
     [StructLayout(LayoutKind.Auto)]
     private readonly record struct Date(int Year, int Month, int Day);
     private readonly record struct Date(int Year, int Month, int Day);

+ 5 - 1
Jint/Native/Function/FunctionInstance.Dynamic.cs

@@ -199,6 +199,10 @@ public partial class Function
             function,
             function,
             scope,
             scope,
             thisMode,
             thisMode,
-            functionPrototype) { _privateEnvironment = privateScope, _realm = _realm };
+            functionPrototype)
+        {
+            _privateEnvironment = privateScope,
+            _realm = _realm,
+        };
     }
     }
 }
 }

+ 9 - 9
Jint/Native/Global/GlobalObject.cs

@@ -113,7 +113,7 @@ public sealed partial class GlobalObject : ObjectInstance
             pow *= radix;
             pow *= radix;
         }
         }
 
 
-        return hasResult ? JsNumber.Create(sign  * result) : JsNumber.DoubleNaN;
+        return hasResult ? JsNumber.Create(sign * result) : JsNumber.DoubleNaN;
     }
     }
 
 
     /// <summary>
     /// <summary>
@@ -223,7 +223,7 @@ public sealed partial class GlobalObject : ObjectInstance
         // we should now have proper input part
         // we should now have proper input part
 
 
 #if SUPPORTS_SPAN_PARSE
 #if SUPPORTS_SPAN_PARSE
-            var substring = trimmedString.AsSpan(0, i);
+        var substring = trimmedString.AsSpan(0, i);
 #else
 #else
         var substring = trimmedString.Substring(0, i);
         var substring = trimmedString.Substring(0, i);
 #endif
 #endif
@@ -389,7 +389,7 @@ public sealed partial class GlobalObject : ObjectInstance
 
 
         return builder.ToString();
         return builder.ToString();
 
 
-        uriError:
+uriError:
         _engine.SignalError(ExceptionHelper.CreateUriError(_realm, "URI malformed"));
         _engine.SignalError(ExceptionHelper.CreateUriError(_realm, "URI malformed"));
         return JsEmpty.Instance;
         return JsEmpty.Instance;
     }
     }
@@ -448,7 +448,7 @@ public sealed partial class GlobalObject : ObjectInstance
                 k += 2;
                 k += 2;
                 if ((B & 0x80) == 0)
                 if ((B & 0x80) == 0)
                 {
                 {
-                    C = (char)B;
+                    C = (char) B;
 #pragma warning disable CA2249
 #pragma warning disable CA2249
                     if (reservedSet == null || !reservedSet.Contains(C))
                     if (reservedSet == null || !reservedSet.Contains(C))
 #pragma warning restore CA2249
 #pragma warning restore CA2249
@@ -508,7 +508,7 @@ public sealed partial class GlobalObject : ObjectInstance
                     }
                     }
 
 
 #if SUPPORTS_SPAN_PARSE
 #if SUPPORTS_SPAN_PARSE
-                        _stringBuilder.Append(Encoding.UTF8.GetString(octets.Slice(0, n)));
+                    _stringBuilder.Append(Encoding.UTF8.GetString(octets.Slice(0, n)));
 #else
 #else
                     _stringBuilder.Append(Encoding.UTF8.GetString(octets, 0, n));
                     _stringBuilder.Append(Encoding.UTF8.GetString(octets, 0, n));
 #endif
 #endif
@@ -518,7 +518,7 @@ public sealed partial class GlobalObject : ObjectInstance
 
 
         return _stringBuilder.ToString();
         return _stringBuilder.ToString();
 
 
-        uriError:
+uriError:
         _engine.SignalError(ExceptionHelper.CreateUriError(_realm, "URI malformed"));
         _engine.SignalError(ExceptionHelper.CreateUriError(_realm, "URI malformed"));
         return JsEmpty.Instance;
         return JsEmpty.Instance;
     }
     }
@@ -555,15 +555,15 @@ public sealed partial class GlobalObject : ObjectInstance
     private static bool IsDigit(char c, int radix, out int result)
     private static bool IsDigit(char c, int radix, out int result)
     {
     {
         int tmp;
         int tmp;
-        if ((uint)(c - '0') <= 9)
+        if ((uint) (c - '0') <= 9)
         {
         {
             result = tmp = c - '0';
             result = tmp = c - '0';
         }
         }
-        else if ((uint)(c - 'A') <= 'Z' - 'A')
+        else if ((uint) (c - 'A') <= 'Z' - 'A')
         {
         {
             result = tmp = c - 'A' + 10;
             result = tmp = c - 'A' + 10;
         }
         }
-        else if ((uint)(c - 'a') <= 'z' - 'a')
+        else if ((uint) (c - 'a') <= 'z' - 'a')
         {
         {
             result = tmp = c - 'a' + 10;
             result = tmp = c - 'a' + 10;
         }
         }

+ 1 - 1
Jint/Native/Intl/IntlInstance.cs

@@ -38,7 +38,7 @@ internal sealed class IntlInstance : ObjectInstance
             ["PluralRules"] = new(_realm.Intrinsics.PluralRules, false, false, true),
             ["PluralRules"] = new(_realm.Intrinsics.PluralRules, false, false, true),
             ["RelativeTimeFormat"] = new(_realm.Intrinsics.RelativeTimeFormat, false, false, true),
             ["RelativeTimeFormat"] = new(_realm.Intrinsics.RelativeTimeFormat, false, false, true),
             ["Segmenter"] = new(_realm.Intrinsics.Segmenter, false, false, true),
             ["Segmenter"] = new(_realm.Intrinsics.Segmenter, false, false, true),
-            ["getCanonicalLocales "] = new(new ClrFunction(Engine, "getCanonicalLocales ", GetCanonicalLocales , 1, PropertyFlag.Configurable), true, false, true),
+            ["getCanonicalLocales "] = new(new ClrFunction(Engine, "getCanonicalLocales ", GetCanonicalLocales, 1, PropertyFlag.Configurable), true, false, true),
         };
         };
         SetProperties(properties);
         SetProperties(properties);
 
 

+ 5 - 5
Jint/Native/JsArrayBuffer.cs

@@ -268,7 +268,7 @@ public class JsArrayBuffer : ObjectInstance
         else
         else
         {
         {
             // inlined conversion for faster speed instead of getting the method in spec
             // inlined conversion for faster speed instead of getting the method in spec
-            var doubleValue  = value.DoubleValue;
+            var doubleValue = value.DoubleValue;
             var intValue = double.IsNaN(doubleValue) || doubleValue == 0 || double.IsInfinity(doubleValue)
             var intValue = double.IsNaN(doubleValue) || doubleValue == 0 || double.IsInfinity(doubleValue)
                 ? 0
                 ? 0
                 : (long) doubleValue;
                 : (long) doubleValue;
@@ -289,28 +289,28 @@ public class JsArrayBuffer : ObjectInstance
 #if !NETSTANDARD2_1
 #if !NETSTANDARD2_1
                     rawBytes = BitConverter.GetBytes((short) intValue);
                     rawBytes = BitConverter.GetBytes((short) intValue);
 #else
 #else
-                        BitConverter.TryWriteBytes(rawBytes, (short) intValue);
+                    BitConverter.TryWriteBytes(rawBytes, (short) intValue);
 #endif
 #endif
                     break;
                     break;
                 case TypedArrayElementType.Uint16:
                 case TypedArrayElementType.Uint16:
 #if !NETSTANDARD2_1
 #if !NETSTANDARD2_1
                     rawBytes = BitConverter.GetBytes((ushort) intValue);
                     rawBytes = BitConverter.GetBytes((ushort) intValue);
 #else
 #else
-                        BitConverter.TryWriteBytes(rawBytes, (ushort) intValue);
+                    BitConverter.TryWriteBytes(rawBytes, (ushort) intValue);
 #endif
 #endif
                     break;
                     break;
                 case TypedArrayElementType.Int32:
                 case TypedArrayElementType.Int32:
 #if !NETSTANDARD2_1
 #if !NETSTANDARD2_1
                     rawBytes = BitConverter.GetBytes((uint) intValue);
                     rawBytes = BitConverter.GetBytes((uint) intValue);
 #else
 #else
-                        BitConverter.TryWriteBytes(rawBytes, (uint) intValue);
+                    BitConverter.TryWriteBytes(rawBytes, (uint) intValue);
 #endif
 #endif
                     break;
                     break;
                 case TypedArrayElementType.Uint32:
                 case TypedArrayElementType.Uint32:
 #if !NETSTANDARD2_1
 #if !NETSTANDARD2_1
                     rawBytes = BitConverter.GetBytes((uint) intValue);
                     rawBytes = BitConverter.GetBytes((uint) intValue);
 #else
 #else
-                        BitConverter.TryWriteBytes(rawBytes, (uint) intValue);
+                    BitConverter.TryWriteBytes(rawBytes, (uint) intValue);
 #endif
 #endif
                     break;
                     break;
                 default:
                 default:

+ 1 - 1
Jint/Native/JsNumber.cs

@@ -128,7 +128,7 @@ public sealed class JsNumber : JsValue, IEquatable<JsNumber>
             return DoubleNegativeInfinity;
             return DoubleNegativeInfinity;
         }
         }
 
 
-        if (double.IsPositiveInfinity(value ))
+        if (double.IsPositiveInfinity(value))
         {
         {
             return DoublePositiveInfinity;
             return DoublePositiveInfinity;
         }
         }

+ 1 - 1
Jint/Native/JsString.cs

@@ -37,7 +37,7 @@ public class JsString : JsValue, IEquatable<JsString>, IEquatable<string>
     [DebuggerBrowsable(DebuggerBrowsableState.Never)]
     [DebuggerBrowsable(DebuggerBrowsableState.Never)]
     internal string _value;
     internal string _value;
 
 
-    private static ConcurrentDictionary<string, JsString> _stringCache;
+    private static readonly ConcurrentDictionary<string, JsString> _stringCache;
 
 
     static JsString()
     static JsString()
     {
     {

+ 10 - 10
Jint/Native/JsValue.cs

@@ -127,17 +127,17 @@ public abstract partial class JsValue : IEquatable<JsValue>
         }
         }
 
 
 #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP
 #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP
-            if (obj is ValueTask valueTask)
-            {
-                return ConvertTaskToPromise(engine, valueTask.AsTask());
-            }
+        if (obj is ValueTask valueTask)
+        {
+            return ConvertTaskToPromise(engine, valueTask.AsTask());
+        }
 
 
-            // ValueTask<T>
-            var asTask = obj.GetType().GetMethod(nameof(ValueTask<object>.AsTask));
-            if (asTask is not null)
-            {
-                return ConvertTaskToPromise(engine, (Task) asTask.Invoke(obj, parameters: null)!);
-            }
+        // ValueTask<T>
+        var asTask = obj.GetType().GetMethod(nameof(ValueTask<object>.AsTask));
+        if (asTask is not null)
+        {
+            return ConvertTaskToPromise(engine, (Task) asTask.Invoke(obj, parameters: null)!);
+        }
 #endif
 #endif
 
 
         return FromObject(engine, JsValue.Undefined);
         return FromObject(engine, JsValue.Undefined);

+ 1 - 1
Jint/Native/JsWeakMap.cs

@@ -31,7 +31,7 @@ internal sealed class JsWeakMap : ObjectInstance
         }
         }
 
 
 #if SUPPORTS_WEAK_TABLE_ADD_OR_UPDATE
 #if SUPPORTS_WEAK_TABLE_ADD_OR_UPDATE
-         _table.AddOrUpdate(key, value);
+        _table.AddOrUpdate(key, value);
 #else
 #else
         _table.Remove(key);
         _table.Remove(key);
         _table.Add(key, value);
         _table.Add(key, value);

+ 26 - 26
Jint/Native/Json/JsonSerializer.cs

@@ -318,37 +318,37 @@ public sealed class JsonSerializer
         json.Append('"');
         json.Append('"');
 
 
 #if NETCOREAPP1_0_OR_GREATER
 #if NETCOREAPP1_0_OR_GREATER
-            fixed (char* ptr = value)
+        fixed (char* ptr = value)
+        {
+            int remainingLength = value.Length;
+            int offset = 0;
+            while (true)
             {
             {
-                int remainingLength = value.Length;
-                int offset = 0;
-                while (true)
+                int index = System.Text.Encodings.Web.JavaScriptEncoder.Default.FindFirstCharacterToEncode(ptr + offset, remainingLength);
+                if (index < 0)
                 {
                 {
-                    int index = System.Text.Encodings.Web.JavaScriptEncoder.Default.FindFirstCharacterToEncode(ptr + offset, remainingLength);
-                    if (index < 0)
-                    {
-                        // append the remaining text which doesn't need any encoding.
-                        json.Append(value.AsSpan(offset));
-                        break;
-                    }
+                    // append the remaining text which doesn't need any encoding.
+                    json.Append(value.AsSpan(offset));
+                    break;
+                }
 
 
-                    index += offset;
-                    if (index - offset > 0)
-                    {
-                        // append everything which does not need any encoding until the found index.
-                        json.Append(value.AsSpan(offset, index - offset));
-                    }
+                index += offset;
+                if (index - offset > 0)
+                {
+                    // append everything which does not need any encoding until the found index.
+                    json.Append(value.AsSpan(offset, index - offset));
+                }
 
 
-                    AppendJsonStringCharacter(value, ref index, ref json);
+                AppendJsonStringCharacter(value, ref index, ref json);
 
 
-                    offset = index + 1;
-                    remainingLength = value.Length - offset;
-                    if (remainingLength == 0)
-                    {
-                        break;
-                    }
+                offset = index + 1;
+                remainingLength = value.Length - offset;
+                if (remainingLength == 0)
+                {
+                    break;
                 }
                 }
             }
             }
+        }
 #else
 #else
         for (var i = 0; i < value.Length; i++)
         for (var i = 0; i < value.Length; i++)
         {
         {
@@ -389,8 +389,8 @@ public sealed class JsonSerializer
                 if (char.IsSurrogatePair(value, index))
                 if (char.IsSurrogatePair(value, index))
                 {
                 {
 #if NETCOREAPP1_0_OR_GREATER
 #if NETCOREAPP1_0_OR_GREATER
-                        json.Append(value.AsSpan(index, 2));
-                        index++;
+                    json.Append(value.AsSpan(index, 2));
+                    index++;
 #else
 #else
                     json.Append(c);
                     json.Append(c);
                     index++;
                     index++;

+ 19 - 19
Jint/Native/Math/MathInstance.cs

@@ -203,7 +203,7 @@ internal sealed class MathInstance : ObjectInstance
 
 
         if (y > 0 && x.Equals(0))
         if (y > 0 && x.Equals(0))
         {
         {
-            return System.Math.PI/2;
+            return System.Math.PI / 2;
         }
         }
 
 
         if (NumberInstance.IsPositiveZero(y))
         if (NumberInstance.IsPositiveZero(y))
@@ -264,7 +264,7 @@ internal sealed class MathInstance : ObjectInstance
         // If y<0 and x is −0, the result is an implementation-dependent approximation to −π/2.
         // If y<0 and x is −0, the result is an implementation-dependent approximation to −π/2.
         if (y < 0 && x.Equals(0))
         if (y < 0 && x.Equals(0))
         {
         {
-            return -System.Math.PI/2;
+            return -System.Math.PI / 2;
         }
         }
 
 
         // If y>0 and y is finite and x is +∞, the result is +0.
         // If y>0 and y is finite and x is +∞, the result is +0.
@@ -302,7 +302,7 @@ internal sealed class MathInstance : ObjectInstance
         // If y is +∞ and x is finite, the result is an implementation-dependent approximation to +π/2.
         // If y is +∞ and x is finite, the result is an implementation-dependent approximation to +π/2.
         if (double.IsPositiveInfinity(y) && !double.IsInfinity(x))
         if (double.IsPositiveInfinity(y) && !double.IsInfinity(x))
         {
         {
-            return System.Math.PI/2;
+            return System.Math.PI / 2;
         }
         }
 
 
         // If y is −∞ and x is finite, the result is an implementation-dependent approximation to −π/2.
         // If y is −∞ and x is finite, the result is an implementation-dependent approximation to −π/2.
@@ -314,7 +314,7 @@ internal sealed class MathInstance : ObjectInstance
         // If y is +∞ and x is +∞, the result is an implementation-dependent approximation to +π/4.
         // If y is +∞ and x is +∞, the result is an implementation-dependent approximation to +π/4.
         if (double.IsPositiveInfinity(y) && double.IsPositiveInfinity(x))
         if (double.IsPositiveInfinity(y) && double.IsPositiveInfinity(x))
         {
         {
-            return System.Math.PI/4;
+            return System.Math.PI / 4;
         }
         }
 
 
         // If y is +∞ and x is −∞, the result is an implementation-dependent approximation to +3π/4.
         // If y is +∞ and x is −∞, the result is an implementation-dependent approximation to +3π/4.
@@ -332,7 +332,7 @@ internal sealed class MathInstance : ObjectInstance
         // If y is −∞ and x is −∞, the result is an implementation-dependent approximation to −3π/4.
         // If y is −∞ and x is −∞, the result is an implementation-dependent approximation to −3π/4.
         if (double.IsNegativeInfinity(y) && double.IsNegativeInfinity(x))
         if (double.IsNegativeInfinity(y) && double.IsNegativeInfinity(x))
         {
         {
-            return - 3 * System.Math.PI / 4;
+            return -3 * System.Math.PI / 4;
         }
         }
 
 
         return System.Math.Atan2(y, x);
         return System.Math.Atan2(y, x);
@@ -820,7 +820,7 @@ internal sealed class MathInstance : ObjectInstance
 
 
     private JsValue Random(JsValue thisObject, JsCallArguments arguments)
     private JsValue Random(JsValue thisObject, JsCallArguments arguments)
     {
     {
-        if(_random == null)
+        if (_random == null)
         {
         {
             _random = new Random();
             _random = new Random();
         }
         }
@@ -853,20 +853,20 @@ internal sealed class MathInstance : ObjectInstance
     private static JsValue F16Round(JsValue thisObject, JsCallArguments arguments)
     private static JsValue F16Round(JsValue thisObject, JsCallArguments arguments)
     {
     {
 #if SUPPORTS_HALF
 #if SUPPORTS_HALF
-            var x = arguments.At(0);
-            var n = TypeConverter.ToNumber(x);
+        var x = arguments.At(0);
+        var n = TypeConverter.ToNumber(x);
 
 
-            if (double.IsNaN(n))
-            {
-                return JsNumber.DoubleNaN;
-            }
+        if (double.IsNaN(n))
+        {
+            return JsNumber.DoubleNaN;
+        }
 
 
-            if (double.IsInfinity(n) || NumberInstance.IsPositiveZero(n) || NumberInstance.IsNegativeZero(n))
-            {
-                return x;
-            }
+        if (double.IsInfinity(n) || NumberInstance.IsPositiveZero(n) || NumberInstance.IsNegativeZero(n))
+        {
+            return x;
+        }
 
 
-            return (double) (Half) n;
+        return (double) (Half) n;
 #else
 #else
         ExceptionHelper.ThrowNotImplementedException("Float16/Half type is not supported in this build");
         ExceptionHelper.ThrowNotImplementedException("Float16/Half type is not supported in this build");
         return default;
         return default;
@@ -1020,7 +1020,7 @@ internal sealed class MathInstance : ObjectInstance
 
 
         if (System.Math.Sign(x) >= 0)
         if (System.Math.Sign(x) >= 0)
         {
         {
-            return System.Math.Pow(x, 1.0/3.0);
+            return System.Math.Pow(x, 1.0 / 3.0);
         }
         }
 
 
         return -1 * System.Math.Pow(System.Math.Abs(x), 1.0 / 3.0);
         return -1 * System.Math.Pow(System.Math.Abs(x), 1.0 / 3.0);
@@ -1128,7 +1128,7 @@ internal sealed class MathInstance : ObjectInstance
                             state = double.NegativeInfinity;
                             state = double.NegativeInfinity;
                         }
                         }
                     }
                     }
-                    else if (!NumberInstance.IsNegativeZero(n) && (NumberInstance.IsNegativeZero(state)  || state == Finite))
+                    else if (!NumberInstance.IsNegativeZero(n) && (NumberInstance.IsNegativeZero(state) || state == Finite))
                     {
                     {
                         state = Finite;
                         state = Finite;
                         sum.Add(n);
                         sum.Add(n);

+ 4 - 4
Jint/Native/Number/Dtoa/BignumDtoa.cs

@@ -11,7 +11,7 @@ internal static class BignumDtoa
         double v,
         double v,
         DtoaMode mode,
         DtoaMode mode,
         int requested_digits,
         int requested_digits,
-        ref  DtoaBuilder builder,
+        ref DtoaBuilder builder,
         out int decimal_point)
         out int decimal_point)
     {
     {
         var bits = (ulong) BitConverter.DoubleToInt64Bits(v);
         var bits = (ulong) BitConverter.DoubleToInt64Bits(v);
@@ -117,7 +117,7 @@ internal static class BignumDtoa
         Bignum delta_minus,
         Bignum delta_minus,
         Bignum delta_plus,
         Bignum delta_plus,
         bool is_even,
         bool is_even,
-        ref  DtoaBuilder buffer)
+        ref DtoaBuilder buffer)
     {
     {
         // Small optimization: if delta_minus and delta_plus are the same just reuse
         // Small optimization: if delta_minus and delta_plus are the same just reuse
         // one of the two bignums.
         // one of the two bignums.
@@ -239,7 +239,7 @@ internal static class BignumDtoa
         ref int decimal_point,
         ref int decimal_point,
         Bignum numerator,
         Bignum numerator,
         Bignum denominator,
         Bignum denominator,
-        ref  DtoaBuilder buffer)
+        ref DtoaBuilder buffer)
     {
     {
         Debug.Assert(count >= 0);
         Debug.Assert(count >= 0);
         for (int i = 0; i < count - 1; ++i)
         for (int i = 0; i < count - 1; ++i)
@@ -286,7 +286,7 @@ internal static class BignumDtoa
         ref int decimal_point,
         ref int decimal_point,
         Bignum numerator,
         Bignum numerator,
         Bignum denominator,
         Bignum denominator,
-        ref  DtoaBuilder buffer)
+        ref DtoaBuilder buffer)
     {
     {
         // Note that we have to look at more than just the requested_digits, since
         // Note that we have to look at more than just the requested_digits, since
         // a number could be rounded up. Example: v=0.5 with requested_digits=0.
         // a number could be rounded up. Example: v=0.5 with requested_digits=0.

+ 1 - 1
Jint/Native/Number/Dtoa/CachePowers.cs

@@ -47,7 +47,7 @@ internal static class CachedPowers
 
 
         internal CachedPower(ulong significand, short binaryExponent, short decimalExponent)
         internal CachedPower(ulong significand, short binaryExponent, short decimalExponent)
         {
         {
-            Significand =  significand;
+            Significand = significand;
             BinaryExponent = binaryExponent;
             BinaryExponent = binaryExponent;
             DecimalExponent = decimalExponent;
             DecimalExponent = decimalExponent;
         }
         }

+ 4 - 4
Jint/Native/Number/Dtoa/DiyFp.cs

@@ -79,10 +79,10 @@ internal readonly struct DiyFp
         ulong b1 = a.F & kM32;
         ulong b1 = a.F & kM32;
         ulong c = b.F >> 32;
         ulong c = b.F >> 32;
         ulong d = b.F & kM32;
         ulong d = b.F & kM32;
-        ulong ac = a1*c;
-        ulong bc = b1*c;
-        ulong ad = a1*d;
-        ulong bd = b1*d;
+        ulong ac = a1 * c;
+        ulong bc = b1 * c;
+        ulong ad = a1 * d;
+        ulong bd = b1 * d;
         ulong tmp = (bd >> 32) + (ad & kM32) + (bc & kM32);
         ulong tmp = (bd >> 32) + (ad & kM32) + (bc & kM32);
         // By adding 1U << 31 to tmp we round the final result.
         // By adding 1U << 31 to tmp we round the final result.
         // Halfway cases will be round up.
         // Halfway cases will be round up.

+ 3 - 2
Jint/Native/Number/Dtoa/DtoaNumberFormatter.cs

@@ -8,7 +8,7 @@ namespace Jint.Native.Number.Dtoa;
 internal static class DtoaNumberFormatter
 internal static class DtoaNumberFormatter
 {
 {
     public static void DoubleToAscii(
     public static void DoubleToAscii(
-        ref  DtoaBuilder buffer,
+        ref DtoaBuilder buffer,
         double v,
         double v,
         DtoaMode mode,
         DtoaMode mode,
         int requested_digits,
         int requested_digits,
@@ -42,7 +42,8 @@ internal static class DtoaNumberFormatter
         }
         }
 
 
         bool fast_worked = false;
         bool fast_worked = false;
-        switch (mode) {
+        switch (mode)
+        {
             case DtoaMode.Shortest:
             case DtoaMode.Shortest:
                 fast_worked = FastDtoa.NumberToString(v, DtoaMode.Shortest, 0, out point, ref buffer);
                 fast_worked = FastDtoa.NumberToString(v, DtoaMode.Shortest, 0, out point, ref buffer);
                 break;
                 break;

+ 14 - 13
Jint/Native/Number/Dtoa/FastDtoa.cs

@@ -64,7 +64,7 @@ internal sealed class FastDtoa
     //    representable number to the input.
     //    representable number to the input.
     //  Modifies the generated digits in the buffer to approach (round towards) w.
     //  Modifies the generated digits in the buffer to approach (round towards) w.
     private static bool RoundWeed(
     private static bool RoundWeed(
-        ref  DtoaBuilder buffer,
+        ref DtoaBuilder buffer,
         ulong distanceTooHighW,
         ulong distanceTooHighW,
         ulong unsafeInterval,
         ulong unsafeInterval,
         ulong rest,
         ulong rest,
@@ -167,7 +167,7 @@ internal sealed class FastDtoa
         //   Since too_low = too_high - unsafe_interval this is equivalent to
         //   Since too_low = too_high - unsafe_interval this is equivalent to
         //      [too_high - unsafe_interval + 4 ulp; too_high - 2 ulp]
         //      [too_high - unsafe_interval + 4 ulp; too_high - 2 ulp]
         //   Conceptually we have: rest ~= too_high - buffer
         //   Conceptually we have: rest ~= too_high - buffer
-        return (2*unit <= rest) && (rest <= unsafeInterval - 4*unit);
+        return (2 * unit <= rest) && (rest <= unsafeInterval - 4 * unit);
     }
     }
 
 
     // Rounds the buffer upwards if the result is closer to v by possibly adding
     // Rounds the buffer upwards if the result is closer to v by possibly adding
@@ -183,7 +183,7 @@ internal sealed class FastDtoa
     //
     //
     // Precondition: rest < ten_kappa.
     // Precondition: rest < ten_kappa.
     static bool RoundWeedCounted(
     static bool RoundWeedCounted(
-        ref  DtoaBuilder buffer,
+        ref DtoaBuilder buffer,
         ulong rest,
         ulong rest,
         ulong ten_kappa,
         ulong ten_kappa,
         ulong unit,
         ulong unit,
@@ -413,7 +413,7 @@ internal sealed class FastDtoa
         in DiyFp low,
         in DiyFp low,
         in DiyFp w,
         in DiyFp w,
         in DiyFp high,
         in DiyFp high,
-        ref  DtoaBuilder buffer,
+        ref DtoaBuilder buffer,
         int mk,
         int mk,
         out int kappa)
         out int kappa)
     {
     {
@@ -459,7 +459,7 @@ internal sealed class FastDtoa
         // that is smaller than integrals.
         // that is smaller than integrals.
         while (kappa > 0)
         while (kappa > 0)
         {
         {
-            int digit = (int) (integrals/divider);
+            int digit = (int) (integrals / divider);
             buffer.Append((char) ('0' + digit));
             buffer.Append((char) ('0' + digit));
             integrals %= divider;
             integrals %= divider;
             kappa--;
             kappa--;
@@ -501,7 +501,7 @@ internal sealed class FastDtoa
         {
         {
             fractionals *= 5;
             fractionals *= 5;
             unit *= 5;
             unit *= 5;
-            unsafeInterval = new DiyFp(unsafeInterval.F*5, unsafeInterval.E + 1); // Will be optimized out.
+            unsafeInterval = new DiyFp(unsafeInterval.F * 5, unsafeInterval.E + 1); // Will be optimized out.
             one = new DiyFp(one.F.UnsignedShift(1), one.E + 1);
             one = new DiyFp(one.F.UnsignedShift(1), one.E + 1);
             // Integer division by one.
             // Integer division by one.
             var digit = (int) ((fractionals.UnsignedShift(-one.E)) & 0xffffffffL);
             var digit = (int) ((fractionals.UnsignedShift(-one.E)) & 0xffffffffL);
@@ -512,7 +512,7 @@ internal sealed class FastDtoa
             {
             {
                 return RoundWeed(
                 return RoundWeed(
                     ref buffer,
                     ref buffer,
-                    DiyFp.Minus(tooHigh, w).F*unit,
+                    DiyFp.Minus(tooHigh, w).F * unit,
                     unsafeInterval.F,
                     unsafeInterval.F,
                     fractionals,
                     fractionals,
                     one.F,
                     one.F,
@@ -552,7 +552,7 @@ internal sealed class FastDtoa
     static bool DigitGenCounted(
     static bool DigitGenCounted(
         in DiyFp w,
         in DiyFp w,
         int requested_digits,
         int requested_digits,
-        ref  DtoaBuilder buffer,
+        ref DtoaBuilder buffer,
         out int kappa)
         out int kappa)
     {
     {
         Debug.Assert(MinimalTargetExponent <= w.E && w.E <= MaximalTargetExponent);
         Debug.Assert(MinimalTargetExponent <= w.E && w.E <= MaximalTargetExponent);
@@ -592,7 +592,7 @@ internal sealed class FastDtoa
         if (requested_digits == 0)
         if (requested_digits == 0)
         {
         {
             ulong rest = (((ulong) integrals) << -one.E) + fractionals;
             ulong rest = (((ulong) integrals) << -one.E) + fractionals;
-            return RoundWeedCounted(ref buffer, rest,(ulong) divisor << -one.E, w_error, ref kappa);
+            return RoundWeedCounted(ref buffer, rest, (ulong) divisor << -one.E, w_error, ref kappa);
         }
         }
 
 
         // The integrals have been generated. We are at the point of the decimal
         // The integrals have been generated. We are at the point of the decimal
@@ -604,7 +604,8 @@ internal sealed class FastDtoa
         Debug.Assert(one.E >= -60);
         Debug.Assert(one.E >= -60);
         Debug.Assert(fractionals < one.F);
         Debug.Assert(fractionals < one.F);
 
 
-        while (requested_digits > 0 && fractionals > w_error) {
+        while (requested_digits > 0 && fractionals > w_error)
+        {
             fractionals *= 10;
             fractionals *= 10;
             w_error *= 10;
             w_error *= 10;
             // Integer division by one.
             // Integer division by one.
@@ -629,7 +630,7 @@ internal sealed class FastDtoa
     // The last digit will be closest to the actual v. That is, even if several
     // The last digit will be closest to the actual v. That is, even if several
     // digits might correctly yield 'v' when read again, the closest will be
     // digits might correctly yield 'v' when read again, the closest will be
     // computed.
     // computed.
-    private static bool Grisu3(double v, ref  DtoaBuilder buffer, out int decimal_exponent)
+    private static bool Grisu3(double v, ref DtoaBuilder buffer, out int decimal_exponent)
     {
     {
         ulong bits = (ulong) BitConverter.DoubleToInt64Bits(v);
         ulong bits = (ulong) BitConverter.DoubleToInt64Bits(v);
         DiyFp w = DoubleHelper.AsNormalizedDiyFp(bits);
         DiyFp w = DoubleHelper.AsNormalizedDiyFp(bits);
@@ -695,7 +696,7 @@ internal sealed class FastDtoa
     static bool Grisu3Counted(
     static bool Grisu3Counted(
         double v,
         double v,
         int requested_digits,
         int requested_digits,
-        ref  DtoaBuilder buffer,
+        ref DtoaBuilder buffer,
         out int decimal_exponent)
         out int decimal_exponent)
     {
     {
         ulong bits = (ulong) BitConverter.DoubleToInt64Bits(v);
         ulong bits = (ulong) BitConverter.DoubleToInt64Bits(v);
@@ -735,7 +736,7 @@ internal sealed class FastDtoa
         DtoaMode mode,
         DtoaMode mode,
         int requested_digits,
         int requested_digits,
         out int decimal_point,
         out int decimal_point,
-        ref  DtoaBuilder buffer)
+        ref DtoaBuilder buffer)
     {
     {
         Debug.Assert(v > 0);
         Debug.Assert(v > 0);
         Debug.Assert(!double.IsNaN(v));
         Debug.Assert(!double.IsNaN(v));

+ 1 - 1
Jint/Native/Number/Dtoa/NumberExtensions.cs

@@ -9,7 +9,7 @@ internal static class NumberExtensions
     {
     {
         return (long) ((ulong) l >> shift);
         return (long) ((ulong) l >> shift);
     }
     }
-        
+
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     internal static ulong UnsignedShift(this ulong l, int shift)
     internal static ulong UnsignedShift(this ulong l, int shift)
     {
     {

+ 4 - 4
Jint/Native/Number/NumberPrototype.cs

@@ -233,7 +233,7 @@ internal sealed class NumberPrototype : NumberInstance
         Debug.Assert(dtoaBuilder.Length <= f + 1);
         Debug.Assert(dtoaBuilder.Length <= f + 1);
 
 
         int exponent = decimalPoint - 1;
         int exponent = decimalPoint - 1;
-        var result = CreateExponentialRepresentation(ref dtoaBuilder, exponent, negative, f+1);
+        var result = CreateExponentialRepresentation(ref dtoaBuilder, exponent, negative, f + 1);
         return result;
         return result;
     }
     }
 
 
@@ -324,7 +324,7 @@ internal sealed class NumberPrototype : NumberInstance
     }
     }
 
 
     private static string CreateExponentialRepresentation(
     private static string CreateExponentialRepresentation(
-        ref  DtoaBuilder buffer,
+        ref DtoaBuilder buffer,
         int exponent,
         int exponent,
         bool negative,
         bool negative,
         int significantDigits)
         int significantDigits)
@@ -401,7 +401,7 @@ internal sealed class NumberPrototype : NumberInstance
         }
         }
 
 
         var integer = (long) x;
         var integer = (long) x;
-        var fraction = x -  integer;
+        var fraction = x - integer;
 
 
         string result = NumberPrototype.ToBase(integer, radix);
         string result = NumberPrototype.ToBase(integer, radix);
         if (fraction != 0)
         if (fraction != 0)
@@ -445,7 +445,7 @@ internal sealed class NumberPrototype : NumberInstance
         var result = new ValueStringBuilder(stackalloc char[64]);
         var result = new ValueStringBuilder(stackalloc char[64]);
         while (n > 0 && result.Length < 50) // arbitrary limit
         while (n > 0 && result.Length < 50) // arbitrary limit
         {
         {
-            var c = n*radix;
+            var c = n * radix;
             var d = (int) c;
             var d = (int) c;
             n = c - d;
             n = c - d;
 
 

+ 2 - 2
Jint/Native/Object/ObjectConstructor.cs

@@ -138,7 +138,7 @@ public sealed class ObjectConstructor : Constructor
             return Construct(arguments);
             return Construct(arguments);
         }
         }
 
 
-        if(arguments[0].IsNullOrUndefined())
+        if (arguments[0].IsNullOrUndefined())
         {
         {
             return Construct(arguments);
             return Construct(arguments);
         }
         }
@@ -186,7 +186,7 @@ public sealed class ObjectConstructor : Constructor
     internal ObjectInstance Construct(int propertyCount)
     internal ObjectInstance Construct(int propertyCount)
     {
     {
         var obj = new JsObject(_engine);
         var obj = new JsObject(_engine);
-        obj.SetProperties(propertyCount > 0  ? new PropertyDictionary(propertyCount, checkExistingKeys: true) : null);
+        obj.SetProperties(propertyCount > 0 ? new PropertyDictionary(propertyCount, checkExistingKeys: true) : null);
         return obj;
         return obj;
     }
     }
 
 

+ 1 - 1
Jint/Native/Object/ObjectPrototype.cs

@@ -56,7 +56,7 @@ public sealed class ObjectPrototype : Prototype
             ["toString"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "toString", prototype.ToObjectString, 0, LengthFlags), PropertyFlags),
             ["toString"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "toString", prototype.ToObjectString, 0, LengthFlags), PropertyFlags),
             ["toLocaleString"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "toLocaleString", prototype.ToLocaleString, 0, LengthFlags), PropertyFlags),
             ["toLocaleString"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "toLocaleString", prototype.ToLocaleString, 0, LengthFlags), PropertyFlags),
             ["valueOf"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "valueOf", prototype.ValueOf, 0, LengthFlags), PropertyFlags),
             ["valueOf"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "valueOf", prototype.ValueOf, 0, LengthFlags), PropertyFlags),
-            ["hasOwnProperty"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "hasOwnProperty",prototype. HasOwnProperty, 1, LengthFlags), PropertyFlags),
+            ["hasOwnProperty"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "hasOwnProperty", prototype.HasOwnProperty, 1, LengthFlags), PropertyFlags),
             ["isPrototypeOf"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "isPrototypeOf", prototype.IsPrototypeOf, 1, LengthFlags), PropertyFlags),
             ["isPrototypeOf"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "isPrototypeOf", prototype.IsPrototypeOf, 1, LengthFlags), PropertyFlags),
             ["propertyIsEnumerable"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "propertyIsEnumerable", prototype.PropertyIsEnumerable, 1, LengthFlags), PropertyFlags)
             ["propertyIsEnumerable"] = new LazyPropertyDescriptor<ObjectPrototype>(this, static prototype => new ClrFunction(prototype._engine, "propertyIsEnumerable", prototype.PropertyIsEnumerable, 1, LengthFlags), PropertyFlags)
         };
         };

+ 1 - 1
Jint/Native/Promise/PromiseConstructor.cs

@@ -47,7 +47,7 @@ internal sealed class PromiseConstructor : Constructor
             ["reject"] = new(new PropertyDescriptor(new ClrFunction(Engine, "reject", Reject, 1, LengthFlags), PropertyFlags)),
             ["reject"] = new(new PropertyDescriptor(new ClrFunction(Engine, "reject", Reject, 1, LengthFlags), PropertyFlags)),
             ["resolve"] = new(new PropertyDescriptor(new ClrFunction(Engine, "resolve", Resolve, 1, LengthFlags), PropertyFlags)),
             ["resolve"] = new(new PropertyDescriptor(new ClrFunction(Engine, "resolve", Resolve, 1, LengthFlags), PropertyFlags)),
             ["try"] = new(new PropertyDescriptor(new ClrFunction(Engine, "try", Try, 1, LengthFlags), PropertyFlags)),
             ["try"] = new(new PropertyDescriptor(new ClrFunction(Engine, "try", Try, 1, LengthFlags), PropertyFlags)),
-            ["withResolvers"] = new(new PropertyDescriptor(new ClrFunction(Engine, "withResolvers", WithResolvers , 0, LengthFlags), PropertyFlags)),
+            ["withResolvers"] = new(new PropertyDescriptor(new ClrFunction(Engine, "withResolvers", WithResolvers, 0, LengthFlags), PropertyFlags)),
         };
         };
         SetProperties(properties);
         SetProperties(properties);
 
 

+ 2 - 2
Jint/Native/SharedArrayBuffer/SharedArrayBufferConstructor.cs

@@ -40,7 +40,7 @@ internal sealed class SharedArrayBufferConstructor : Constructor
 
 
         var symbols = new SymbolDictionary(1)
         var symbols = new SymbolDictionary(1)
         {
         {
-            [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunction(Engine, "get [Symbol.species]", Species, 0, lengthFlags), set: Undefined,PropertyFlag.Configurable),
+            [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunction(Engine, "get [Symbol.species]", Species, 0, lengthFlags), set: Undefined, PropertyFlag.Configurable),
         };
         };
         SetSymbols(symbols);
         SetSymbols(symbols);
     }
     }
@@ -84,7 +84,7 @@ internal sealed class SharedArrayBufferConstructor : Constructor
         return AllocateSharedArrayBuffer(newTarget, byteLength, requestedMaxByteLength);
         return AllocateSharedArrayBuffer(newTarget, byteLength, requestedMaxByteLength);
     }
     }
 
 
-    private JsSharedArrayBuffer AllocateSharedArrayBuffer(JsValue constructor, uint byteLength, uint? maxByteLength  = null)
+    private JsSharedArrayBuffer AllocateSharedArrayBuffer(JsValue constructor, uint byteLength, uint? maxByteLength = null)
     {
     {
         var allocatingGrowableBuffer = maxByteLength != null;
         var allocatingGrowableBuffer = maxByteLength != null;
 
 

+ 3 - 3
Jint/Native/String/StringConstructor.cs

@@ -62,11 +62,11 @@ internal sealed class StringConstructor : Constructor
         }
         }
 
 
 #if SUPPORTS_SPAN_PARSE
 #if SUPPORTS_SPAN_PARSE
-            var elements = length < 512 ? stackalloc char[length] : new char[length];
+        var elements = length < 512 ? stackalloc char[length] : new char[length];
 #else
 #else
         var elements = new char[length];
         var elements = new char[length];
 #endif
 #endif
-        for (var i = 0; i < elements.Length; i++ )
+        for (var i = 0; i < elements.Length; i++)
         {
         {
             var nextCu = TypeConverter.ToUint16(arguments[i]);
             var nextCu = TypeConverter.ToUint16(arguments[i]);
             elements[i] = (char) nextCu;
             elements[i] = (char) nextCu;
@@ -122,7 +122,7 @@ internal sealed class StringConstructor : Constructor
 
 
         return JsString.Create(result.ToString());
         return JsString.Create(result.ToString());
 
 
-        rangeError:
+rangeError:
         _engine.SignalError(ExceptionHelper.CreateRangeError(_realm, "Invalid code point " + codePoint));
         _engine.SignalError(ExceptionHelper.CreateRangeError(_realm, "Invalid code point " + codePoint));
         return JsEmpty.Instance;
         return JsEmpty.Instance;
     }
     }

+ 4 - 4
Jint/Native/String/StringPrototype.cs

@@ -598,7 +598,7 @@ internal sealed class StringPrototype : StringInstance
         else
         else
         {
         {
             var captures = System.Array.Empty<string>();
             var captures = System.Array.Empty<string>();
-            replStr =  RegExpPrototype.GetSubstitution(searchString, thisString.ToString(), position, captures, Undefined, TypeConverter.ToString(replaceValue));
+            replStr = RegExpPrototype.GetSubstitution(searchString, thisString.ToString(), position, captures, Undefined, TypeConverter.ToString(replaceValue));
         }
         }
 
 
         var tailPos = position + searchString.Length;
         var tailPos = position + searchString.Length;
@@ -686,7 +686,7 @@ internal sealed class StringPrototype : StringInstance
             else
             else
             {
             {
                 var captures = System.Array.Empty<string>();
                 var captures = System.Array.Empty<string>();
-                replacement =  RegExpPrototype.GetSubstitution(searchString, thisString, position, captures, Undefined, TypeConverter.ToString(replaceValue));
+                replacement = RegExpPrototype.GetSubstitution(searchString, thisString, position, captures, Undefined, TypeConverter.ToString(replaceValue));
             }
             }
 
 
             result.Append(preserved);
             result.Append(preserved);
@@ -789,7 +789,7 @@ internal sealed class StringPrototype : StringInstance
         var pos = double.IsNaN(numPos) ? double.PositiveInfinity : TypeConverter.ToInteger(numPos);
         var pos = double.IsNaN(numPos) ? double.PositiveInfinity : TypeConverter.ToInteger(numPos);
 
 
         var len = jsString.Length;
         var len = jsString.Length;
-        var start = (int)System.Math.Min(System.Math.Max(pos, 0), len);
+        var start = (int) System.Math.Min(System.Math.Max(pos, 0), len);
         var searchLen = searchStr.Length;
         var searchLen = searchStr.Length;
 
 
         if (searchLen > len)
         if (searchLen > len)
@@ -899,7 +899,7 @@ internal sealed class StringPrototype : StringInstance
 
 
         JsValue pos = arguments.Length > 0 ? arguments[0] : 0;
         JsValue pos = arguments.Length > 0 ? arguments[0] : 0;
         var s = TypeConverter.ToString(thisObject);
         var s = TypeConverter.ToString(thisObject);
-        var position = (int)TypeConverter.ToInteger(pos);
+        var position = (int) TypeConverter.ToInteger(pos);
         if (position < 0 || position >= s.Length)
         if (position < 0 || position >= s.Length)
         {
         {
             return Undefined;
             return Undefined;

+ 4 - 3
Jint/Native/Symbol/SymbolPrototype.cs

@@ -39,9 +39,10 @@ internal sealed class SymbolPrototype : Prototype
         });
         });
 
 
         SetSymbols(new SymbolDictionary(1)
         SetSymbols(new SymbolDictionary(1)
-            {
-                [GlobalSymbolRegistry.ToPrimitive] = new PropertyDescriptor(new ClrFunction(Engine, "[Symbol.toPrimitive]", ToPrimitive, 1, lengthFlags), propertyFlags), [GlobalSymbolRegistry.ToStringTag] = new PropertyDescriptor(new JsString("Symbol"), propertyFlags)
-            }
+        {
+            [GlobalSymbolRegistry.ToPrimitive] = new PropertyDescriptor(new ClrFunction(Engine, "[Symbol.toPrimitive]", ToPrimitive, 1, lengthFlags), propertyFlags),
+            [GlobalSymbolRegistry.ToStringTag] = new PropertyDescriptor(new JsString("Symbol"), propertyFlags)
+        }
         );
         );
     }
     }
 
 

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

@@ -49,7 +49,7 @@ internal sealed class IntrinsicTypedArrayPrototype : Prototype
             ["fill"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "fill", prototype.Fill, 1, PropertyFlag.Configurable), PropertyFlags),
             ["fill"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "fill", prototype.Fill, 1, PropertyFlag.Configurable), PropertyFlags),
             ["filter"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "filter", prototype.Filter, 1, PropertyFlag.Configurable), PropertyFlags),
             ["filter"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "filter", prototype.Filter, 1, PropertyFlag.Configurable), PropertyFlags),
             ["find"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "find", prototype.Find, 1, PropertyFlag.Configurable), PropertyFlags),
             ["find"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "find", prototype.Find, 1, PropertyFlag.Configurable), PropertyFlags),
-            ["findIndex"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "findIndex",prototype. FindIndex, 1, PropertyFlag.Configurable), PropertyFlags),
+            ["findIndex"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "findIndex", prototype.FindIndex, 1, PropertyFlag.Configurable), PropertyFlags),
             ["findLast"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "findLast", prototype.FindLast, 1, PropertyFlag.Configurable), PropertyFlags),
             ["findLast"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "findLast", prototype.FindLast, 1, PropertyFlag.Configurable), PropertyFlags),
             ["findLastIndex"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "findLastIndex", prototype.FindLastIndex, 1, PropertyFlag.Configurable), PropertyFlags),
             ["findLastIndex"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "findLastIndex", prototype.FindLastIndex, 1, PropertyFlag.Configurable), PropertyFlags),
             ["forEach"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "forEach", prototype.ForEach, 1, PropertyFlag.Configurable), PropertyFlags),
             ["forEach"] = new LazyPropertyDescriptor<IntrinsicTypedArrayPrototype>(this, static prototype => new ClrFunction(prototype._engine, "forEach", prototype.ForEach, 1, PropertyFlag.Configurable), PropertyFlags),
@@ -205,7 +205,7 @@ internal sealed class IntrinsicTypedArrayPrototype : Prototype
                     return o._arrayLength;
                     return o._arrayLength;
                 }
                 }
 
 
-                var byteOffset  = o._byteOffset;
+                var byteOffset = o._byteOffset;
                 var elementSize = o._arrayElementType.GetElementSize();
                 var elementSize = o._arrayElementType.GetElementSize();
                 var byteLength = (double) CachedBufferByteLength;
                 var byteLength = (double) CachedBufferByteLength;
                 var floor = System.Math.Floor((byteLength - byteOffset) / elementSize);
                 var floor = System.Math.Floor((byteLength - byteOffset) / elementSize);

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

@@ -297,7 +297,7 @@ public abstract class TypedArrayConstructor : Constructor
         return obj;
         return obj;
     }
     }
 
 
-    internal static void FillTypedArrayInstance<T>(JsTypedArray target, ReadOnlySpan<T>values)
+    internal static void FillTypedArrayInstance<T>(JsTypedArray target, ReadOnlySpan<T> values)
     {
     {
         for (var i = 0; i < values.Length; ++i)
         for (var i = 0; i < values.Length; ++i)
         {
         {

+ 5 - 5
Jint/Native/TypedArray/Uint8ArrayPrototype.cs

@@ -119,7 +119,7 @@ internal sealed class Uint8ArrayPrototype : Prototype
 
 
     private JsValue ToBase64(JsValue thisObject, JsCallArguments arguments)
     private JsValue ToBase64(JsValue thisObject, JsCallArguments arguments)
     {
     {
-       var o = ValidateUint8Array(thisObject);
+        var o = ValidateUint8Array(thisObject);
 
 
         var opts = Uint8ArrayConstructor.GetOptionsObject(_engine, arguments.At(0));
         var opts = Uint8ArrayConstructor.GetOptionsObject(_engine, arguments.At(0));
         var alphabet = Uint8ArrayConstructor.GetAndValidateAlphabetOption(_engine, opts);
         var alphabet = Uint8ArrayConstructor.GetAndValidateAlphabetOption(_engine, opts);
@@ -156,11 +156,11 @@ internal sealed class Uint8ArrayPrototype : Prototype
         using var outString = new ValueStringBuilder();
         using var outString = new ValueStringBuilder();
         foreach (var b in toEncode)
         foreach (var b in toEncode)
         {
         {
-            var b1 = (byte)(b >> 4);
-            outString.Append((char)(b1 > 9 ? b1 - 10 + 'a' : b1 + '0'));
+            var b1 = (byte) (b >> 4);
+            outString.Append((char) (b1 > 9 ? b1 - 10 + 'a' : b1 + '0'));
 
 
-            var b2 = (byte)(b & 0x0F);
-            outString.Append((char)(b2 > 9 ? b2 - 10 + 'a' : b2 + '0'));
+            var b2 = (byte) (b & 0x0F);
+            outString.Append((char) (b2 > 9 ? b2 - 10 + 'a' : b2 + '0'));
         }
         }
 
 
         return outString.ToString();
         return outString.ToString();

+ 1 - 1
Jint/Native/WeakMap/WeakMapConstructor.cs

@@ -34,7 +34,7 @@ internal sealed class WeakMapConstructor : Constructor
 
 
         var map = OrdinaryCreateFromConstructor(
         var map = OrdinaryCreateFromConstructor(
             newTarget,
             newTarget,
-            static intrinsics =>  intrinsics.WeakMap.PrototypeObject,
+            static intrinsics => intrinsics.WeakMap.PrototypeObject,
             static (Engine engine, Realm _, object? _) => new JsWeakMap(engine));
             static (Engine engine, Realm _, object? _) => new JsWeakMap(engine));
         if (arguments.Length > 0 && !arguments[0].IsNullOrUndefined())
         if (arguments.Length > 0 && !arguments[0].IsNullOrUndefined())
         {
         {

+ 6 - 6
Jint/Pooling/ValueStringBuilder.cs

@@ -48,7 +48,7 @@ internal ref struct ValueStringBuilder
         Debug.Assert(capacity >= 0);
         Debug.Assert(capacity >= 0);
 
 
         // If the caller has a bug and calls this with negative capacity, make sure to call Grow to throw an exception.
         // If the caller has a bug and calls this with negative capacity, make sure to call Grow to throw an exception.
-        if ((uint)capacity > (uint)_chars.Length)
+        if ((uint) capacity > (uint) _chars.Length)
             Grow(capacity - _pos);
             Grow(capacity - _pos);
     }
     }
 
 
@@ -177,7 +177,7 @@ internal ref struct ValueStringBuilder
     {
     {
         int pos = _pos;
         int pos = _pos;
         Span<char> chars = _chars;
         Span<char> chars = _chars;
-        if ((uint)pos < (uint)chars.Length)
+        if ((uint) pos < (uint) chars.Length)
         {
         {
             chars[pos] = c;
             chars[pos] = c;
             _pos = pos + 1;
             _pos = pos + 1;
@@ -209,7 +209,7 @@ internal ref struct ValueStringBuilder
         }
         }
 
 
         int pos = _pos;
         int pos = _pos;
-        if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc.
+        if (s.Length == 1 && (uint) pos < (uint) _chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc.
         {
         {
             _chars[pos] = s[0];
             _chars[pos] = s[0];
             _pos = pos + 1;
             _pos = pos + 1;
@@ -344,9 +344,9 @@ internal ref struct ValueStringBuilder
 
 
         // Increase to at least the required size (_pos + additionalCapacityBeyondPos), but try
         // Increase to at least the required size (_pos + additionalCapacityBeyondPos), but try
         // to double the size if possible, bounding the doubling to not go beyond the max array length.
         // to double the size if possible, bounding the doubling to not go beyond the max array length.
-        int newCapacity = (int)Math.Max(
-            (uint)(_pos + additionalCapacityBeyondPos),
-            Math.Min((uint)_chars.Length * 2, ArrayMaxLength));
+        int newCapacity = (int) Math.Max(
+            (uint) (_pos + additionalCapacityBeyondPos),
+            Math.Min((uint) _chars.Length * 2, ArrayMaxLength));
 
 
         // Make sure to let Rent throw an exception if the caller has a bug and the desired capacity is negative.
         // Make sure to let Rent throw an exception if the caller has a bug and the desired capacity is negative.
         // This could also go negative if the actual required length wraps around.
         // This could also go negative if the actual required length wraps around.

+ 1 - 1
Jint/Runtime/CallStack/CallStackElementComparer.cs

@@ -1,6 +1,6 @@
 namespace Jint.Runtime.CallStack;
 namespace Jint.Runtime.CallStack;
 
 
-internal sealed class CallStackElementComparer: IEqualityComparer<CallStackElement>
+internal sealed class CallStackElementComparer : IEqualityComparer<CallStackElement>
 {
 {
     public static readonly CallStackElementComparer Instance = new();
     public static readonly CallStackElementComparer Instance = new();
 
 

+ 1 - 1
Jint/Runtime/DefaultTimeSystem.cs

@@ -68,7 +68,7 @@ public class DefaultTimeSystem : ITimeSystem
         }
         }
 
 
         // special check for large years that always require + or - in front and have 6 digit year
         // special check for large years that always require + or - in front and have 6 digit year
-        if ((date[0] == '+'|| date[0] == '-') && date.IndexOf('-', 1) == 7)
+        if ((date[0] == '+' || date[0] == '-') && date.IndexOf('-', 1) == 7)
         {
         {
             return TryParseLargeYear(date, out epochMilliseconds);
             return TryParseLargeYear(date, out epochMilliseconds);
         }
         }

+ 1 - 1
Jint/Runtime/Environments/DeclarativeEnvironment.cs

@@ -196,7 +196,7 @@ internal static class DictionaryExtensions
     }
     }
 
 
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
-    internal static void CreateImmutableBinding<T>(this T dictionary, Key name, bool strict = true)  where T : IEngineDictionary<Key, Binding>
+    internal static void CreateImmutableBinding<T>(this T dictionary, Key name, bool strict = true) where T : IEngineDictionary<Key, Binding>
     {
     {
         dictionary[name] = new Binding(null!, canBeDeleted: false, mutable: false, strict);
         dictionary[name] = new Binding(null!, canBeDeleted: false, mutable: false, strict);
     }
     }

+ 1 - 1
Jint/Runtime/Environments/FunctionEnvironment.cs

@@ -190,7 +190,7 @@ internal sealed class FunctionEnvironment : DeclarativeEnvironment
             ExceptionHelper.ThrowTypeError(_functionObject._realm, "Destructed parameter is null or undefined");
             ExceptionHelper.ThrowTypeError(_functionObject._realm, "Destructed parameter is null or undefined");
         }
         }
 
 
-        var argumentObject = TypeConverter.ToObject(_engine.Realm , argument);
+        var argumentObject = TypeConverter.ToObject(_engine.Realm, argument);
 
 
         ref readonly var properties = ref objectPattern.Properties;
         ref readonly var properties = ref objectPattern.Properties;
         var processedProperties = properties.Count > 0 && properties[properties.Count - 1] is RestElement
         var processedProperties = properties.Count > 0 && properties[properties.Count - 1] is RestElement

+ 1 - 1
Jint/Runtime/ITimeSystem.cs

@@ -15,7 +15,7 @@ public interface ITimeSystem
     /// </summary>
     /// </summary>
     /// <returns>Current UTC time.</returns>
     /// <returns>Current UTC time.</returns>
     DateTimeOffset GetUtcNow();
     DateTimeOffset GetUtcNow();
-    
+
     /// <summary>
     /// <summary>
     /// Return the default time zone system is using. Usually <see cref="TimeZoneInfo.Local"/>, but can be altered via
     /// Return the default time zone system is using. Usually <see cref="TimeZoneInfo.Local"/>, but can be altered via
     /// engine configuration, see <see cref="Options.TimeZone"/>.
     /// engine configuration, see <see cref="Options.TimeZone"/>.

+ 24 - 24
Jint/Runtime/Interop/DefaultObjectConverter.cs

@@ -81,20 +81,20 @@ internal static class DefaultObjectConverter
                 }
                 }
 
 
 #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP
 #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP
-                    if (value is ValueTask valueTask)
-                    {
-                        result = JsValue.ConvertAwaitableToPromise(engine, valueTask);
-                        return result is not null;
-                    }
+                if (value is ValueTask valueTask)
+                {
+                    result = JsValue.ConvertAwaitableToPromise(engine, valueTask);
+                    return result is not null;
+                }
 #endif
 #endif
             }
             }
 
 
 #if NET8_0_OR_GREATER
 #if NET8_0_OR_GREATER
-                if (value is System.Text.Json.Nodes.JsonValue jsonValue)
-                {
-                    result = ConvertSystemTextJsonValue(engine, jsonValue);
-                    return result is not null;
-                }
+            if (value is System.Text.Json.Nodes.JsonValue jsonValue)
+            {
+                result = ConvertSystemTextJsonValue(engine, jsonValue);
+                return result is not null;
+            }
 #endif
 #endif
 
 
             var t = value.GetType();
             var t = value.GetType();
@@ -160,23 +160,23 @@ internal static class DefaultObjectConverter
     }
     }
 
 
 #if NET8_0_OR_GREATER
 #if NET8_0_OR_GREATER
-        private static JsValue? ConvertSystemTextJsonValue(Engine engine, System.Text.Json.Nodes.JsonValue value)
+    private static JsValue? ConvertSystemTextJsonValue(Engine engine, System.Text.Json.Nodes.JsonValue value)
+    {
+        return value.GetValueKind() switch
         {
         {
-            return value.GetValueKind() switch
-            {
-                System.Text.Json.JsonValueKind.Object => JsValue.FromObject(engine, value),
-                System.Text.Json.JsonValueKind.Array => JsValue.FromObject(engine, value),
-                System.Text.Json.JsonValueKind.String => JsString.Create(value.ToString()),
+            System.Text.Json.JsonValueKind.Object => JsValue.FromObject(engine, value),
+            System.Text.Json.JsonValueKind.Array => JsValue.FromObject(engine, value),
+            System.Text.Json.JsonValueKind.String => JsString.Create(value.ToString()),
 #pragma warning disable IL2026, IL3050
 #pragma warning disable IL2026, IL3050
-                System.Text.Json.JsonValueKind.Number => value.TryGetValue<int>(out var intValue) ? JsNumber.Create(intValue) : System.Text.Json.JsonSerializer.Deserialize<double>(value),
+            System.Text.Json.JsonValueKind.Number => value.TryGetValue<int>(out var intValue) ? JsNumber.Create(intValue) : System.Text.Json.JsonSerializer.Deserialize<double>(value),
 #pragma warning restore IL2026, IL3050
 #pragma warning restore IL2026, IL3050
-                System.Text.Json.JsonValueKind.True => JsBoolean.True,
-                System.Text.Json.JsonValueKind.False => JsBoolean.False,
-                System.Text.Json.JsonValueKind.Undefined => JsValue.Undefined,
-                System.Text.Json.JsonValueKind.Null => JsValue.Null,
-                _ => null
-            };
-        }
+            System.Text.Json.JsonValueKind.True => JsBoolean.True,
+            System.Text.Json.JsonValueKind.False => JsBoolean.False,
+            System.Text.Json.JsonValueKind.Undefined => JsValue.Undefined,
+            System.Text.Json.JsonValueKind.Null => JsValue.Null,
+            _ => null
+        };
+    }
 #endif
 #endif
 
 
     private static bool TryConvertConvertible(Engine engine, IConvertible convertible, [NotNullWhen(true)] out JsValue? result)
     private static bool TryConvertConvertible(Engine engine, IConvertible convertible, [NotNullWhen(true)] out JsValue? result)

+ 11 - 11
Jint/Runtime/Interop/DelegateWrapper.cs

@@ -158,19 +158,19 @@ internal sealed class DelegateWrapper : Function
             return true;
             return true;
         }
         }
 #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP
 #if NETSTANDARD2_1_OR_GREATER || NETCOREAPP
-            if (obj is ValueTask)
-            {
-                return true;
-            }
+        if (obj is ValueTask)
+        {
+            return true;
+        }
 
 
-            // ValueTask<T> is not derived from ValueTask, so we need to check for it explicitly
-            var type = obj.GetType();
-            if (!type.IsGenericType)
-            {
-                return false;
-            }
+        // ValueTask<T> is not derived from ValueTask, so we need to check for it explicitly
+        var type = obj.GetType();
+        if (!type.IsGenericType)
+        {
+            return false;
+        }
 
 
-            return type.GetGenericTypeDefinition() == typeof(ValueTask<>);
+        return type.GetGenericTypeDefinition() == typeof(ValueTask<>);
 #else
 #else
         return false;
         return false;
 #endif
 #endif

+ 1 - 1
Jint/Runtime/Interop/GetterFunction.cs

@@ -6,7 +6,7 @@ namespace Jint.Runtime.Interop;
 /// <summary>
 /// <summary>
 /// Represents a FunctionInstance wrapping a CLR getter.
 /// Represents a FunctionInstance wrapping a CLR getter.
 /// </summary>
 /// </summary>
-internal sealed class GetterFunction: Function
+internal sealed class GetterFunction : Function
 {
 {
     private static readonly JsString _name = new JsString("get");
     private static readonly JsString _name = new JsString("get");
     private readonly Func<JsValue, JsValue> _getter;
     private readonly Func<JsValue, JsValue> _getter;

+ 2 - 2
Jint/Runtime/Interop/ObjectWrapper.cs

@@ -215,7 +215,7 @@ public class ObjectWrapper : ObjectInstance, IObjectWrapper, IEquatable<ObjectWr
 
 
     public override List<JsValue> GetOwnPropertyKeys(Types types = Types.Empty | Types.String | Types.Symbol)
     public override List<JsValue> GetOwnPropertyKeys(Types types = Types.Empty | Types.String | Types.Symbol)
     {
     {
-        return [..EnumerateOwnPropertyKeys(types)];
+        return [.. EnumerateOwnPropertyKeys(types)];
     }
     }
 
 
     public override IEnumerable<KeyValuePair<JsValue, PropertyDescriptor>> GetOwnProperties()
     public override IEnumerable<KeyValuePair<JsValue, PropertyDescriptor>> GetOwnProperties()
@@ -225,7 +225,7 @@ public class ObjectWrapper : ObjectInstance, IObjectWrapper, IEquatable<ObjectWr
             yield return new KeyValuePair<JsValue, PropertyDescriptor>(key, GetOwnProperty(key));
             yield return new KeyValuePair<JsValue, PropertyDescriptor>(key, GetOwnProperty(key));
         }
         }
     }
     }
-    
+
     private IEnumerable<JsValue> EnumerateOwnPropertyKeys(Types types)
     private IEnumerable<JsValue> EnumerateOwnPropertyKeys(Types types)
     {
     {
         // prefer object order, add possible other properties after
         // prefer object order, add possible other properties after

+ 1 - 1
Jint/Runtime/Interop/Reflection/IndexerAccessor.cs

@@ -88,7 +88,7 @@ internal sealed class IndexerAccessor : ReflectionAccessor
                 indexerAccessor = ComposeIndexerFactory(engine, targetType, candidate, paramType, propertyName, integerKey, paramTypeArray);
                 indexerAccessor = ComposeIndexerFactory(engine, targetType, candidate, paramType, propertyName, integerKey, paramTypeArray);
                 if (indexerAccessor != null)
                 if (indexerAccessor != null)
                 {
                 {
-                    if (paramType != typeof(string) ||  integerKey is null)
+                    if (paramType != typeof(string) || integerKey is null)
                     {
                     {
                         // exact match, we don't need to check for integer key
                         // exact match, we don't need to check for integer key
                         indexer = candidate;
                         indexer = candidate;

+ 1 - 1
Jint/Runtime/Interop/TypeReference.cs

@@ -308,7 +308,7 @@ public sealed class TypeReference : Constructor, IObjectWrapper
             var memberNameComparer = typeResolver.MemberNameComparer;
             var memberNameComparer = typeResolver.MemberNameComparer;
             var typeResolverMemberNameCreator = typeResolver.MemberNameCreator;
             var typeResolverMemberNameCreator = typeResolver.MemberNameCreator;
 #if NET7_0_OR_GREATER
 #if NET7_0_OR_GREATER
-                var enumValues = type.GetEnumValuesAsUnderlyingType();
+            var enumValues = type.GetEnumValuesAsUnderlyingType();
 #else
 #else
             var enumValues = Enum.GetValues(type);
             var enumValues = Enum.GetValues(type);
 #endif
 #endif

+ 2 - 2
Jint/Runtime/Interop/TypeResolver.cs

@@ -274,7 +274,7 @@ public sealed class TypeResolver
 
 
         if (paramType == typeof(int))
         if (paramType == typeof(int))
         {
         {
-            return  isInteger ? 0 : 10;
+            return isInteger ? 0 : 10;
         }
         }
 
 
         if (paramType == typeof(string))
         if (paramType == typeof(string))
@@ -483,7 +483,7 @@ public sealed class TypeResolver
             if (equals && x.Length > 1)
             if (equals && x.Length > 1)
             {
             {
 #if SUPPORTS_SPAN_PARSE
 #if SUPPORTS_SPAN_PARSE
-                    equals = x.AsSpan(1).SequenceEqual(y.AsSpan(1));
+                equals = x.AsSpan(1).SequenceEqual(y.AsSpan(1));
 #else
 #else
                 equals = string.Equals(x.Substring(1), y.Substring(1), StringComparison.Ordinal);
                 equals = string.Equals(x.Substring(1), y.Substring(1), StringComparison.Ordinal);
 #endif
 #endif

+ 1 - 1
Jint/Runtime/Interpreter/DeclarationCache.cs

@@ -67,7 +67,7 @@ internal static class DeclarationCacheBuilder
                 continue;
                 continue;
             }
             }
 
 
-            var rootVariable = (VariableDeclaration)node;
+            var rootVariable = (VariableDeclaration) node;
             if (rootVariable.Kind == VariableDeclarationKind.Var)
             if (rootVariable.Kind == VariableDeclarationKind.Var)
             {
             {
                 continue;
                 continue;

+ 1 - 1
Jint/Runtime/Interpreter/Expressions/DestructuringPatternAssignmentExpression.cs

@@ -222,7 +222,7 @@ internal sealed class DestructuringPatternAssignmentExpression : JintExpression
                     }
                     }
                     else
                     else
                     {
                     {
-                        AssignToReference(engine, reference!,  array, environment);
+                        AssignToReference(engine, reference!, array, environment);
                     }
                     }
                 }
                 }
                 else if (left is AssignmentPattern assignmentPattern)
                 else if (left is AssignmentPattern assignmentPattern)

+ 4 - 4
Jint/Runtime/Interpreter/Expressions/JintBinaryExpression.cs

@@ -298,7 +298,7 @@ internal abstract class JintBinaryExpression : JintExpression
 
 
             if (AreIntegerOperands(left, right))
             if (AreIntegerOperands(left, right))
             {
             {
-                return JsNumber.Create((long)left.AsInteger() + right.AsInteger());
+                return JsNumber.Create((long) left.AsInteger() + right.AsInteger());
             }
             }
 
 
             var lprim = TypeConverter.ToPrimitive(left);
             var lprim = TypeConverter.ToPrimitive(left);
@@ -308,7 +308,7 @@ internal abstract class JintBinaryExpression : JintExpression
             {
             {
                 result = JsString.Create(TypeConverter.ToString(lprim) + TypeConverter.ToString(rprim));
                 result = JsString.Create(TypeConverter.ToString(lprim) + TypeConverter.ToString(rprim));
             }
             }
-            else if (AreNonBigIntOperands(left,right))
+            else if (AreNonBigIntOperands(left, right))
             {
             {
                 result = JsNumber.Create(TypeConverter.ToNumber(lprim) + TypeConverter.ToNumber(rprim));
                 result = JsNumber.Create(TypeConverter.ToNumber(lprim) + TypeConverter.ToNumber(rprim));
             }
             }
@@ -347,7 +347,7 @@ internal abstract class JintBinaryExpression : JintExpression
 
 
             if (AreIntegerOperands(left, right))
             if (AreIntegerOperands(left, right))
             {
             {
-                number = JsNumber.Create((long)left.AsInteger() - right.AsInteger());
+                number = JsNumber.Create((long) left.AsInteger() - right.AsInteger());
             }
             }
             else if (AreNonBigIntOperands(left, right))
             else if (AreNonBigIntOperands(left, right))
             {
             {
@@ -525,7 +525,7 @@ internal abstract class JintBinaryExpression : JintExpression
             var right = TypeConverter.ToNumeric(rightReference);
             var right = TypeConverter.ToNumeric(rightReference);
 
 
             JsValue result;
             JsValue result;
-            if (AreNonBigIntOperands(left,right))
+            if (AreNonBigIntOperands(left, right))
             {
             {
                 // validation
                 // validation
                 var baseNumber = (JsNumber) left;
                 var baseNumber = (JsNumber) left;

+ 1 - 1
Jint/Runtime/Interpreter/Expressions/JintSequenceExpression.cs

@@ -31,7 +31,7 @@ internal sealed class JintSequenceExpression : JintExpression
             Initialize();
             Initialize();
             _initialized = true;
             _initialized = true;
         }
         }
-            
+
         var result = JsValue.Undefined;
         var result = JsValue.Undefined;
         foreach (var expression in _expressions)
         foreach (var expression in _expressions)
         {
         {

+ 1 - 1
Jint/Runtime/Interpreter/JintFunctionDefinition.cs

@@ -330,7 +330,7 @@ internal sealed class JintFunctionDefinition
         ref bool hasDuplicates,
         ref bool hasDuplicates,
         ref bool hasArguments)
         ref bool hasArguments)
     {
     {
-        Start:
+Start:
         if (parameter.Type == NodeType.Identifier)
         if (parameter.Type == NodeType.Identifier)
         {
         {
             var key = (Key) ((Identifier) parameter).Name;
             var key = (Key) ((Identifier) parameter).Name;

+ 1 - 1
Jint/Runtime/Interpreter/Statements/ConstantReturnStatement.cs

@@ -5,7 +5,7 @@ namespace Jint.Runtime.Interpreter.Statements;
 internal sealed class ConstantStatement : JintStatement
 internal sealed class ConstantStatement : JintStatement
 {
 {
     private readonly JsValue _value;
     private readonly JsValue _value;
-    private CompletionType _completionType;
+    private readonly CompletionType _completionType;
 
 
     public ConstantStatement(Statement statement, CompletionType completionType, JsValue value) : base(statement)
     public ConstantStatement(Statement statement, CompletionType completionType, JsValue value) : base(statement)
     {
     {

+ 1 - 1
Jint/Runtime/Interpreter/Statements/JintSwitchBlock.cs

@@ -44,7 +44,7 @@ internal sealed class JintSwitchBlock
 
 
         DeclarativeEnvironment? blockEnv = null;
         DeclarativeEnvironment? blockEnv = null;
 
 
-        start:
+start:
         for (; i < temp.Length; i++)
         for (; i < temp.Length; i++)
         {
         {
             var clause = temp[i];
             var clause = temp[i];

+ 1 - 1
Jint/Runtime/OrderedSet.cs

@@ -36,7 +36,7 @@ internal sealed class OrderedSet<T> : IEnumerable<T>
         return new OrderedSet<T>(EqualityComparer<T>.Default)
         return new OrderedSet<T>(EqualityComparer<T>.Default)
         {
         {
             _set = new HashSet<T>(this._set, this._set.Comparer),
             _set = new HashSet<T>(this._set, this._set.Comparer),
-            _list = [..this._list]
+            _list = [.. this._list]
         };
         };
     }
     }
 
 

+ 2 - 2
Jint/Runtime/TypeConverter.cs

@@ -287,7 +287,7 @@ public static class TypeConverter
                 return -0.0;
                 return -0.0;
             }
             }
 
 
-            return firstChar == '-' ? - 1 * n : n;
+            return firstChar == '-' ? -1 * n : n;
         }
         }
         catch (Exception e) when (e is OverflowException)
         catch (Exception e) when (e is OverflowException)
         {
         {
@@ -670,7 +670,7 @@ public static class TypeConverter
             {
             {
                 // we get better precision if we don't hit floating point parsing that is performed by Esprima
                 // we get better precision if we don't hit floating point parsing that is performed by Esprima
 #if SUPPORTS_SPAN_PARSE
 #if SUPPORTS_SPAN_PARSE
-                    var source = str.AsSpan(2);
+                var source = str.AsSpan(2);
 #else
 #else
                 var source = str.Substring(2);
                 var source = str.Substring(2);
 #endif
 #endif