Selaa lähdekoodia

Remove some Instance suffixes (#1718)

* BindFunctionInstance -> BindFunction
* ClrFunctionInstance -> ClrFunction
* GetterFunctionInstance -> GetterFunction and made internal
* IPrimitiveInstance -> IJsPrimitive
* MethodInfoFunctionInstance -> MethodInfoFunction
* ScriptFunctionInstance -> ScriptFunction
* SetterFunctionInstance -> SetterFunction and made internal
* make JsonInstance internal
Marko Lahma 1 vuosi sitten
vanhempi
commit
a3e919be49
100 muutettua tiedostoa jossa 592 lisäystä ja 596 poistoa
  1. 1 1
      Jint.Repl/Program.cs
  2. 1 1
      Jint.Tests.PublicInterface/PublicInterfaceTests.cs
  3. 1 1
      Jint.Tests.PublicInterface/RavenApiUsageTests.cs
  4. 5 5
      Jint.Tests.Test262/Test262Test.cs
  5. 1 1
      Jint.Tests/Runtime/Domain/UuidConstructor.cs
  6. 2 2
      Jint.Tests/Runtime/Domain/UuidPrototype.cs
  7. 2 2
      Jint.Tests/Runtime/ExecutionConstraintTests.cs
  8. 1 1
      Jint.Tests/Runtime/FunctionTests.cs
  9. 1 1
      Jint.Tests/Runtime/InteropTests.Json.cs
  10. 4 4
      Jint.Tests/Runtime/InteropTests.cs
  11. 2 2
      Jint.Tests/Runtime/NullPropagation.cs
  12. 1 1
      Jint.Tests/Runtime/PropertyDescriptorTests.cs
  13. 4 4
      Jint/Engine.cs
  14. 1 1
      Jint/EsprimaExtensions.cs
  15. 4 4
      Jint/ModuleBuilder.cs
  16. 4 4
      Jint/Native/Argument/JsArguments.cs
  17. 4 4
      Jint/Native/Array/ArrayConstructor.cs
  18. 1 1
      Jint/Native/Array/ArrayIteratorPrototype.cs
  19. 40 40
      Jint/Native/Array/ArrayPrototype.cs
  20. 2 2
      Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs
  21. 8 8
      Jint/Native/ArrayBuffer/ArrayBufferPrototype.cs
  22. 2 2
      Jint/Native/BigInt/BigIntConstructor.cs
  23. 3 3
      Jint/Native/BigInt/BigIntInstance.cs
  24. 3 3
      Jint/Native/BigInt/BigIntPrototype.cs
  25. 3 3
      Jint/Native/Boolean/BooleanInstance.cs
  26. 2 2
      Jint/Native/Boolean/BooleanPrototype.cs
  27. 23 23
      Jint/Native/DataView/DataViewPrototype.cs
  28. 3 3
      Jint/Native/Date/DateConstructor.cs
  29. 46 46
      Jint/Native/Date/DatePrototype.cs
  30. 1 1
      Jint/Native/Error/ErrorPrototype.cs
  31. 1 1
      Jint/Native/FinalizationRegistry/FinalizationRegistryPrototype.cs
  32. 2 2
      Jint/Native/Function/BindFunction.cs
  33. 3 3
      Jint/Native/Function/ClassDefinition.cs
  34. 1 1
      Jint/Native/Function/EvalFunctionInstance.cs
  35. 3 3
      Jint/Native/Function/FunctionConstructor.cs
  36. 2 2
      Jint/Native/Function/FunctionInstance.Dynamic.cs
  37. 1 1
      Jint/Native/Function/FunctionInstance.cs
  38. 7 7
      Jint/Native/Function/FunctionPrototype.cs
  39. 3 3
      Jint/Native/Function/ScriptFunction.cs
  40. 3 3
      Jint/Native/Generator/GeneratorPrototype.cs
  41. 11 11
      Jint/Native/Global/GlobalObject.Properties.cs
  42. 1 1
      Jint/Native/IJsPrimitive.cs
  43. 1 1
      Jint/Native/Intl/IntlInstance.cs
  44. 1 1
      Jint/Native/Iterator/IteratorPrototype.cs
  45. 5 7
      Jint/Native/Json/JsonInstance.cs
  46. 2 2
      Jint/Native/Map/MapConstructor.cs
  47. 1 1
      Jint/Native/Map/MapIteratorPrototype.cs
  48. 11 11
      Jint/Native/Map/MapPrototype.cs
  49. 35 35
      Jint/Native/Math/MathInstance.cs
  50. 6 6
      Jint/Native/Number/NumberConstructor.cs
  51. 3 3
      Jint/Native/Number/NumberInstance.cs
  52. 6 6
      Jint/Native/Number/NumberPrototype.cs
  53. 23 23
      Jint/Native/Object/ObjectConstructor.cs
  54. 2 2
      Jint/Native/Object/ObjectInstance.Private.cs
  55. 12 12
      Jint/Native/Object/ObjectPrototype.cs
  56. 2 2
      Jint/Native/Promise/JsPromise.cs
  57. 13 13
      Jint/Native/Promise/PromiseConstructor.cs
  58. 9 9
      Jint/Native/Promise/PromisePrototype.cs
  59. 2 2
      Jint/Native/Proxy/ProxyConstructor.cs
  60. 13 13
      Jint/Native/Reflect/ReflectInstance.cs
  61. 1 1
      Jint/Native/RegExp/RegExpConstructor.cs
  62. 12 12
      Jint/Native/RegExp/RegExpPrototype.cs
  63. 1 1
      Jint/Native/RegExp/RegExpStringIteratorPrototype.cs
  64. 1 1
      Jint/Native/Set/SetConstructor.cs
  65. 1 1
      Jint/Native/Set/SetIteratorPrototype.cs
  66. 11 11
      Jint/Native/Set/SetPrototype.cs
  67. 2 2
      Jint/Native/ShadowRealm/ShadowRealmPrototype.cs
  68. 2 2
      Jint/Native/SharedArrayBuffer/SharedArrayBufferConstructor.cs
  69. 5 5
      Jint/Native/SharedArrayBuffer/SharedArrayBufferPrototype.cs
  70. 3 3
      Jint/Native/String/StringConstructor.cs
  71. 3 3
      Jint/Native/String/StringInstance.cs
  72. 1 1
      Jint/Native/String/StringIteratorPrototype.cs
  73. 36 36
      Jint/Native/String/StringPrototype.cs
  74. 2 2
      Jint/Native/Symbol/SymbolConstructor.cs
  75. 3 3
      Jint/Native/Symbol/SymbolInstance.cs
  76. 4 4
      Jint/Native/Symbol/SymbolPrototype.cs
  77. 3 3
      Jint/Native/TypedArray/IntrinsicTypedArrayConstructor.cs
  78. 38 38
      Jint/Native/TypedArray/IntrinsicTypedArrayPrototype.cs
  79. 4 4
      Jint/Native/WeakMap/WeakMapPrototype.cs
  80. 1 1
      Jint/Native/WeakRef/WeakRefPrototype.cs
  81. 4 4
      Jint/Native/WeakSet/WeakSetPrototype.cs
  82. 6 6
      Jint/Options.cs
  83. 7 7
      Jint/Pooling/ArgumentsInstancePool.cs
  84. 4 4
      Jint/Runtime/Descriptors/Specialized/ClrAccessDescriptor.cs
  85. 2 2
      Jint/Runtime/Descriptors/Specialized/ReflectionDescriptor.cs
  86. 1 1
      Jint/Runtime/Environments/FunctionEnvironment.cs
  87. 2 2
      Jint/Runtime/Host.cs
  88. 6 6
      Jint/Runtime/Interop/ClrFunction.cs
  89. 24 0
      Jint/Runtime/Interop/GetterFunction.cs
  90. 0 25
      Jint/Runtime/Interop/GetterFunctionInstance.cs
  91. 4 4
      Jint/Runtime/Interop/MethodInfoFunction.cs
  92. 2 2
      Jint/Runtime/Interop/ObjectWrapper.cs
  93. 1 1
      Jint/Runtime/Interop/Reflection/MethodAccessor.cs
  94. 26 0
      Jint/Runtime/Interop/SetterFunction.cs
  95. 0 27
      Jint/Runtime/Interop/SetterFunctionInstance.cs
  96. 1 1
      Jint/Runtime/Interop/TypeReference.cs
  97. 1 1
      Jint/Runtime/Interpreter/Expressions/JintCallExpression.cs
  98. 4 4
      Jint/Runtime/Interpreter/Expressions/JintFunctionExpression.cs
  99. 1 1
      Jint/Runtime/Interpreter/Expressions/JintIdentifierExpression.cs
  100. 1 1
      Jint/Runtime/Interpreter/JintFunctionDefinition.cs

+ 1 - 1
Jint.Repl/Program.cs

@@ -62,7 +62,7 @@ while (true)
     {
         var result = engine.Evaluate(input, parserOptions);
         JsValue str = result;
-        if (!result.IsPrimitive() && result is not IPrimitiveInstance)
+        if (!result.IsPrimitive() && result is not IJsPrimitive)
         {
             str = serializer.Serialize(result, JsValue.Undefined, "  ");
             if (str == JsValue.Undefined)

+ 1 - 1
Jint.Tests.PublicInterface/PublicInterfaceTests.cs

@@ -54,7 +54,7 @@ var coolingObject = {
                             {
                                 _engine.Invoke(fi);
                             }
-                            else if (queueEntry is BindFunctionInstance bfi)
+                            else if (queueEntry is BindFunction bfi)
                             {
                                 _engine.Invoke(bfi);
                             }

+ 1 - 1
Jint.Tests.PublicInterface/RavenApiUsageTests.cs

@@ -31,7 +31,7 @@ public class RavenApiUsageTests
             strict: false,
             async: false);
 
-        var functionObject = new ScriptFunctionInstance(
+        var functionObject = new ScriptFunction(
             engine,
             functionExp,
             engine.Advanced.CreateDeclarativeEnvironment(),

+ 5 - 5
Jint.Tests.Test262/Test262Test.cs

@@ -27,10 +27,10 @@ public abstract partial class Test262Test
         engine.Execute(State.Sources["assert.js"]);
         engine.Execute(State.Sources["sta.js"]);
 
-        engine.SetValue("print", new ClrFunctionInstance(engine, "print", (_, args) => TypeConverter.ToString(args.At(0))));
+        engine.SetValue("print", new ClrFunction(engine, "print", (_, args) => TypeConverter.ToString(args.At(0))));
 
         var o = engine.Realm.Intrinsics.Object.Construct(Arguments.Empty);
-        o.FastSetProperty("evalScript", new PropertyDescriptor(new ClrFunctionInstance(engine, "evalScript",
+        o.FastSetProperty("evalScript", new PropertyDescriptor(new ClrFunction(engine, "evalScript",
             (_, args) =>
             {
                 if (args.Length > 1)
@@ -45,7 +45,7 @@ public abstract partial class Test262Test
                 return engine.Evaluate(script);
             }), true, true, true));
 
-        o.FastSetProperty("createRealm", new PropertyDescriptor(new ClrFunctionInstance(engine, "createRealm",
+        o.FastSetProperty("createRealm", new PropertyDescriptor(new ClrFunction(engine, "createRealm",
             (_, args) =>
             {
                 var realm = engine._host.CreateRealm();
@@ -53,7 +53,7 @@ public abstract partial class Test262Test
                 return realm.GlobalObject;
             }), true, true, true));
 
-        o.FastSetProperty("detachArrayBuffer", new PropertyDescriptor(new ClrFunctionInstance(engine, "detachArrayBuffer",
+        o.FastSetProperty("detachArrayBuffer", new PropertyDescriptor(new ClrFunction(engine, "detachArrayBuffer",
             (_, args) =>
             {
                 var buffer = (JsArrayBuffer) args.At(0);
@@ -61,7 +61,7 @@ public abstract partial class Test262Test
                 return JsValue.Undefined;
             }), true, true, true));
 
-        o.FastSetProperty("gc", new PropertyDescriptor(new ClrFunctionInstance(engine, "gc",
+        o.FastSetProperty("gc", new PropertyDescriptor(new ClrFunction(engine, "gc",
             (_, _) =>
             {
                 GC.Collect();

+ 1 - 1
Jint.Tests/Runtime/Domain/UuidConstructor.cs

@@ -57,7 +57,7 @@ namespace Jint.Tests.Runtime.Domain
 
         public void Configure()
         {
-            FastSetProperty("parse", new PropertyDescriptor(new ClrFunctionInstance(Engine, "parse", Parse), true, false, true));
+            FastSetProperty("parse", new PropertyDescriptor(new ClrFunction(Engine, "parse", Parse), true, false, true));
             FastSetProperty("Empty", new PropertyDescriptor(JsUuid.Empty, true, false, true));
         }
 

+ 2 - 2
Jint.Tests/Runtime/Domain/UuidPrototype.cs

@@ -35,8 +35,8 @@ namespace Jint.Tests.Runtime.Domain
 
         public void Configure()
         {
-            FastSetProperty("toString", new PropertyDescriptor(new ClrFunctionInstance(Engine, "toString", ToGuidString), true, false, true));
-            FastSetProperty("valueOf", new PropertyDescriptor(new ClrFunctionInstance(Engine, "valueOf", ValueOf), true, false, true));
+            FastSetProperty("toString", new PropertyDescriptor(new ClrFunction(Engine, "toString", ToGuidString), true, false, true));
+            FastSetProperty("valueOf", new PropertyDescriptor(new ClrFunction(Engine, "valueOf", ValueOf), true, false, true));
         }
     }
 }

+ 2 - 2
Jint.Tests/Runtime/ExecutionConstraintTests.cs

@@ -360,9 +360,9 @@ myarr[0](0);
 
         private class MyApi
         {
-            public readonly Dictionary<string, ScriptFunctionInstance> Callbacks = new Dictionary<string, ScriptFunctionInstance>();
+            public readonly Dictionary<string, ScriptFunction> Callbacks = new Dictionary<string, ScriptFunction>();
 
-            public void AddEventListener(string eventName, ScriptFunctionInstance callback)
+            public void AddEventListener(string eventName, ScriptFunction callback)
             {
                 Callbacks.Add(eventName, callback);
             }

+ 1 - 1
Jint.Tests/Runtime/FunctionTests.cs

@@ -83,7 +83,7 @@ assertEqual(booleanCount, 1);
 ";
         var engine = new Engine();
         engine
-            .SetValue("testFunction", new ClrFunctionInstance(engine, "testFunction", (thisValue, args) =>
+            .SetValue("testFunction", new ClrFunction(engine, "testFunction", (thisValue, args) =>
             {
                 return engine.Invoke(thisValue, "then", new[] { JsValue.Undefined, args.At(0) });
             }))

+ 1 - 1
Jint.Tests/Runtime/InteropTests.Json.cs

@@ -83,7 +83,7 @@ public partial class InteropTests
                 // custom serializer hook for known object types
                 if (member == "toJSON" && target is TimeSpan)
                 {
-                    return new ClrFunctionInstance(e, "toJSON", (thisObject, _) =>
+                    return new ClrFunction(e, "toJSON", (thisObject, _) =>
                     {
                         // here could check other types too
                         var wrappedInstance = ((IObjectWrapper) thisObject).Target;

+ 4 - 4
Jint.Tests/Runtime/InteropTests.cs

@@ -3019,7 +3019,7 @@ namespace Jint.Tests.Runtime
         public void CanUseClrFunction()
         {
             var engine = new Engine();
-            engine.SetValue("fn", new ClrFunctionInstance(engine, "fn", (_, args) => (JsValue) (args[0].AsInteger() + 1)));
+            engine.SetValue("fn", new ClrFunction(engine, "fn", (_, args) => (JsValue) (args[0].AsInteger() + 1)));
 
             var result = engine.Evaluate("fn(1)");
 
@@ -3030,7 +3030,7 @@ namespace Jint.Tests.Runtime
         public void ShouldAllowClrExceptionsThrough()
         {
             var engine = new Engine(opts => opts.CatchClrExceptions(exc => false));
-            engine.SetValue("fn", new ClrFunctionInstance(engine, "fn", (_, _) => throw new InvalidOperationException("This is a C# error")));
+            engine.SetValue("fn", new ClrFunction(engine, "fn", (_, _) => throw new InvalidOperationException("This is a C# error")));
             const string Source = @"
 function wrap() {
   fn();
@@ -3045,7 +3045,7 @@ wrap();
         public void ShouldConvertClrExceptionsToErrors()
         {
             var engine = new Engine(opts => opts.CatchClrExceptions(exc => exc is InvalidOperationException));
-            engine.SetValue("fn", new ClrFunctionInstance(engine, "fn", (_, _) => throw new InvalidOperationException("This is a C# error")));
+            engine.SetValue("fn", new ClrFunction(engine, "fn", (_, _) => throw new InvalidOperationException("This is a C# error")));
             const string Source = @"
 function wrap() {
   fn();
@@ -3061,7 +3061,7 @@ wrap();
         public void ShouldAllowCatchingConvertedClrExceptions()
         {
             var engine = new Engine(opts => opts.CatchClrExceptions(exc => exc is InvalidOperationException));
-            engine.SetValue("fn", new ClrFunctionInstance(engine, "fn", (_, _) => throw new InvalidOperationException("This is a C# error")));
+            engine.SetValue("fn", new ClrFunction(engine, "fn", (_, _) => throw new InvalidOperationException("This is a C# error")));
             const string Source = @"
 try {
   fn();

+ 2 - 2
Jint.Tests/Runtime/NullPropagation.cs

@@ -27,12 +27,12 @@ namespace Jint.Tests.Runtime
                     var name = reference.ReferencedName.AsString();
                     if (name == "filter")
                     {
-                        value = new ClrFunctionInstance(engine, "map", (thisObj, values) => engine.Realm.Intrinsics.Array.ArrayCreate(0));
+                        value = new ClrFunction(engine, "map", (thisObj, values) => engine.Realm.Intrinsics.Array.ArrayCreate(0));
                         return true;
                     }
                 }
 
-                value = new ClrFunctionInstance(engine, "anonymous", (thisObj, values) => thisObj);
+                value = new ClrFunction(engine, "anonymous", (thisObj, values) => thisObj);
                 return true;
             }
 

+ 1 - 1
Jint.Tests/Runtime/PropertyDescriptorTests.cs

@@ -167,7 +167,7 @@ public class PropertyDescriptorTests
     {
         JsValue ExtractClrAccessDescriptor(JsValue jsArugments)
         {
-            var pd = ((ArgumentsInstance) jsArugments).ParameterMap.GetOwnProperty("0");
+            var pd = ((JsArguments) jsArugments).ParameterMap.GetOwnProperty("0");
             return new ObjectWrapper(_engine, pd);
         }
         _engine.SetValue("ExtractClrAccessDescriptor", ExtractClrAccessDescriptor);

+ 4 - 4
Jint/Engine.cs

@@ -1035,7 +1035,7 @@ namespace Jint
         /// <summary>
         /// https://tc39.es/ecma262/#sec-functiondeclarationinstantiation
         /// </summary>
-        internal ArgumentsInstance? FunctionDeclarationInstantiation(
+        internal JsArguments? FunctionDeclarationInstantiation(
             FunctionInstance functionInstance,
             JsValue[] argumentsList)
         {
@@ -1055,7 +1055,7 @@ namespace Jint
             var arguments = canInitializeParametersOnDeclaration ? argumentsList : null;
             env.InitializeParameters(parameterNames, hasDuplicates, arguments);
 
-            ArgumentsInstance? ao = null;
+            JsArguments? ao = null;
             if (configuration.ArgumentsObjectNeeded || _isDebugMode)
             {
                 if (strict || !simpleParameterList)
@@ -1176,7 +1176,7 @@ namespace Jint
             return ao;
         }
 
-        private ArgumentsInstance CreateMappedArgumentsObject(
+        private JsArguments CreateMappedArgumentsObject(
             FunctionInstance func,
             Key[] formals,
             JsValue[] argumentsList,
@@ -1186,7 +1186,7 @@ namespace Jint
             return _argumentsInstancePool.Rent(func, formals, argumentsList, envRec, hasRestParameter);
         }
 
-        private ArgumentsInstance CreateUnmappedArgumentsObject(JsValue[] argumentsList)
+        private JsArguments CreateUnmappedArgumentsObject(JsValue[] argumentsList)
         {
             return _argumentsInstancePool.Rent(argumentsList);
         }

+ 1 - 1
Jint/EsprimaExtensions.cs

@@ -471,7 +471,7 @@ namespace Jint
             return (expression as Identifier)?.Name ?? (expression as Literal)!.StringValue!;
         }
 
-        internal readonly record struct Record(JsValue Key, ScriptFunctionInstance Closure);
+        internal readonly record struct Record(JsValue Key, ScriptFunction Closure);
 
         /// <summary>
         /// Creates a dummy node that can be used when only location available and node is required.

+ 4 - 4
Jint/ModuleBuilder.cs

@@ -90,19 +90,19 @@ public sealed class ModuleBuilder
 
     public ModuleBuilder ExportFunction(string name, Func<JsValue[], JsValue> fn)
     {
-        _exports.Add(name, new ClrFunctionInstance(_engine, name, (_, args) => fn(args)));
+        _exports.Add(name, new ClrFunction(_engine, name, (_, args) => fn(args)));
         return this;
     }
 
     public ModuleBuilder ExportFunction(string name, Func<JsValue> fn)
     {
-        _exports.Add(name, new ClrFunctionInstance(_engine, name, (_, _) => fn()));
+        _exports.Add(name, new ClrFunction(_engine, name, (_, _) => fn()));
         return this;
     }
 
     public ModuleBuilder ExportFunction(string name, Action<JsValue[]> fn)
     {
-        _exports.Add(name, new ClrFunctionInstance(_engine, name, (_, args) =>
+        _exports.Add(name, new ClrFunction(_engine, name, (_, args) =>
         {
             fn(args);
             return JsValue.Undefined;
@@ -112,7 +112,7 @@ public sealed class ModuleBuilder
 
     public ModuleBuilder ExportFunction(string name, Action fn)
     {
-        _exports.Add(name, new ClrFunctionInstance(_engine, name, (_, _) =>
+        _exports.Add(name, new ClrFunction(_engine, name, (_, _) =>
         {
             fn();
             return JsValue.Undefined;

+ 4 - 4
Jint/Native/Argument/ArgumentsInstance.cs → Jint/Native/Argument/JsArguments.cs

@@ -11,9 +11,9 @@ using Jint.Runtime.Interop;
 namespace Jint.Native.Argument
 {
     /// <summary>
-    /// http://www.ecma-international.org/ecma-262/5.1/#sec-10.6
+    /// https://tc39.es/ecma262/#sec-arguments-exotic-objects
     /// </summary>
-    internal sealed class ArgumentsInstance : ObjectInstance
+    internal sealed class JsArguments : ObjectInstance
     {
         // cache property container for array iteration for less allocations
         private static readonly ThreadLocal<HashSet<string>> _mappedNamed = new(() => new HashSet<string>(StringComparer.Ordinal));
@@ -26,7 +26,7 @@ namespace Jint.Native.Argument
         private bool _hasRestParameter;
         private bool _materialized;
 
-        internal ArgumentsInstance(Engine engine)
+        internal JsArguments(Engine engine)
             : base(engine, ObjectClass.Arguments)
         {
         }
@@ -98,7 +98,7 @@ namespace Jint.Native.Argument
                 DefinePropertyOrThrow(CommonProperties.Callee, new PropertyDescriptor(_func, PropertyFlag.NonEnumerable));
             }
 
-            var iteratorFunction = new ClrFunctionInstance(Engine, "iterator", _engine.Realm.Intrinsics.Array.PrototypeObject.Values, 0, PropertyFlag.Configurable);
+            var iteratorFunction = new ClrFunction(Engine, "iterator", _engine.Realm.Intrinsics.Array.PrototypeObject.Values, 0, PropertyFlag.Configurable);
             DefinePropertyOrThrow(GlobalSymbolRegistry.Iterator, new PropertyDescriptor(iteratorFunction, PropertyFlag.Writable | PropertyFlag.Configurable));
         }
 

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

@@ -35,15 +35,15 @@ namespace Jint.Native.Array
         {
             var properties = new PropertyDictionary(3, checkExistingKeys: false)
             {
-                ["from"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunctionInstance(Engine, "from", From, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable)),
-                ["isArray"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunctionInstance(Engine, "isArray", IsArray, 1), PropertyFlag.NonEnumerable)),
-                ["of"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunctionInstance(Engine, "of", Of, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable))
+                ["from"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunction(Engine, "from", From, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable)),
+                ["isArray"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunction(Engine, "isArray", IsArray, 1), PropertyFlag.NonEnumerable)),
+                ["of"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunction(Engine, "of", Of, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable))
             };
             SetProperties(properties);
 
             var symbols = new SymbolDictionary(1)
             {
-                [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunctionInstance(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);
         }

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

@@ -25,7 +25,7 @@ internal sealed class ArrayIteratorPrototype : IteratorPrototype
     {
         var properties = new PropertyDictionary(1, checkExistingKeys: false)
         {
-            [KnownKeys.Next] = new(new ClrFunctionInstance(Engine, "next", Next, 0, PropertyFlag.Configurable), true, false, true)
+            [KnownKeys.Next] = new(new ClrFunction(Engine, "next", Next, 0, PropertyFlag.Configurable), true, false, true)
         };
         SetProperties(properties);
 

+ 40 - 40
Jint/Native/Array/ArrayPrototype.cs

@@ -21,7 +21,7 @@ namespace Jint.Native.Array
     {
         private readonly Realm _realm;
         private readonly ArrayConstructor _constructor;
-        internal ClrFunctionInstance? _originalIteratorFunction;
+        internal ClrFunction? _originalIteratorFunction;
 
         internal ArrayPrototype(
             Engine engine,
@@ -42,48 +42,48 @@ namespace Jint.Native.Array
             {
                 ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
 
-                ["at"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "at", At, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["concat"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "concat", Concat, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["copyWithin"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "copyWithin", CopyWithin, 2, PropertyFlag.Configurable), PropertyFlags),
-                ["entries"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "entries", Entries, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["every"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "every", Every, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["fill"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "fill", Fill, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["filter"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "filter", Filter, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["find"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "find", Find, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["findIndex"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "findIndex", FindIndex, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["findLast"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "findLast", FindLast, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["findLastIndex"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "findLastIndex", FindLastIndex, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["flat"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "flat", Flat, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["flatMap"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "flatMap", FlatMap, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["forEach"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "forEach", ForEach, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["includes"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "includes", Includes, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["indexOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "indexOf", IndexOf, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["join"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "join", Join, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["keys"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "keys", Keys, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["lastIndexOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "lastIndexOf", LastIndexOf, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["map"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "map", Map, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["pop"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "pop", Pop, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["push"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "push", Push, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["reduce"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "reduce", Reduce, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["reduceRight"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "reduceRight", ReduceRight, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["reverse"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "reverse", Reverse, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["shift"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "shift", Shift, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["slice"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "slice", Slice, 2, PropertyFlag.Configurable), PropertyFlags),
-                ["some"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "some", Some, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["sort"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "sort", Sort, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["splice"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "splice", Splice, 2, PropertyFlag.Configurable), PropertyFlags),
-                ["toLocaleString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toLocaleString", ToLocaleString, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["toReversed"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toReversed", ToReversed, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["toSorted"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toSorted", ToSorted, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["toSpliced"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toSpliced", ToSpliced, 2, PropertyFlag.Configurable), PropertyFlags),
-                ["toString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toString", ToString, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["unshift"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "unshift", Unshift, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["values"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "values", Values, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["with"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "with", With, 2, PropertyFlag.Configurable), PropertyFlags),
+                ["at"] = new PropertyDescriptor(new ClrFunction(Engine, "at", At, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["concat"] = new PropertyDescriptor(new ClrFunction(Engine, "concat", Concat, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["copyWithin"] = new PropertyDescriptor(new ClrFunction(Engine, "copyWithin", CopyWithin, 2, PropertyFlag.Configurable), PropertyFlags),
+                ["entries"] = new PropertyDescriptor(new ClrFunction(Engine, "entries", Entries, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["every"] = new PropertyDescriptor(new ClrFunction(Engine, "every", Every, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["fill"] = new PropertyDescriptor(new ClrFunction(Engine, "fill", Fill, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["filter"] = new PropertyDescriptor(new ClrFunction(Engine, "filter", Filter, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["find"] = new PropertyDescriptor(new ClrFunction(Engine, "find", Find, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["findIndex"] = new PropertyDescriptor(new ClrFunction(Engine, "findIndex", FindIndex, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["findLast"] = new PropertyDescriptor(new ClrFunction(Engine, "findLast", FindLast, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["findLastIndex"] = new PropertyDescriptor(new ClrFunction(Engine, "findLastIndex", FindLastIndex, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["flat"] = new PropertyDescriptor(new ClrFunction(Engine, "flat", Flat, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["flatMap"] = new PropertyDescriptor(new ClrFunction(Engine, "flatMap", FlatMap, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["forEach"] = new PropertyDescriptor(new ClrFunction(Engine, "forEach", ForEach, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["includes"] = new PropertyDescriptor(new ClrFunction(Engine, "includes", Includes, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["indexOf"] = new PropertyDescriptor(new ClrFunction(Engine, "indexOf", IndexOf, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["join"] = new PropertyDescriptor(new ClrFunction(Engine, "join", Join, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["keys"] = new PropertyDescriptor(new ClrFunction(Engine, "keys", Keys, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["lastIndexOf"] = new PropertyDescriptor(new ClrFunction(Engine, "lastIndexOf", LastIndexOf, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["map"] = new PropertyDescriptor(new ClrFunction(Engine, "map", Map, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["pop"] = new PropertyDescriptor(new ClrFunction(Engine, "pop", Pop, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["push"] = new PropertyDescriptor(new ClrFunction(Engine, "push", Push, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["reduce"] = new PropertyDescriptor(new ClrFunction(Engine, "reduce", Reduce, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["reduceRight"] = new PropertyDescriptor(new ClrFunction(Engine, "reduceRight", ReduceRight, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["reverse"] = new PropertyDescriptor(new ClrFunction(Engine, "reverse", Reverse, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["shift"] = new PropertyDescriptor(new ClrFunction(Engine, "shift", Shift, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["slice"] = new PropertyDescriptor(new ClrFunction(Engine, "slice", Slice, 2, PropertyFlag.Configurable), PropertyFlags),
+                ["some"] = new PropertyDescriptor(new ClrFunction(Engine, "some", Some, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["sort"] = new PropertyDescriptor(new ClrFunction(Engine, "sort", Sort, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["splice"] = new PropertyDescriptor(new ClrFunction(Engine, "splice", Splice, 2, PropertyFlag.Configurable), PropertyFlags),
+                ["toLocaleString"] = new PropertyDescriptor(new ClrFunction(Engine, "toLocaleString", ToLocaleString, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["toReversed"] = new PropertyDescriptor(new ClrFunction(Engine, "toReversed", ToReversed, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["toSorted"] = new PropertyDescriptor(new ClrFunction(Engine, "toSorted", ToSorted, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["toSpliced"] = new PropertyDescriptor(new ClrFunction(Engine, "toSpliced", ToSpliced, 2, PropertyFlag.Configurable), PropertyFlags),
+                ["toString"] = new PropertyDescriptor(new ClrFunction(Engine, "toString", ToString, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["unshift"] = new PropertyDescriptor(new ClrFunction(Engine, "unshift", Unshift, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["values"] = new PropertyDescriptor(new ClrFunction(Engine, "values", Values, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["with"] = new PropertyDescriptor(new ClrFunction(Engine, "with", With, 2, PropertyFlag.Configurable), PropertyFlags),
             };
             SetProperties(properties);
 
-            _originalIteratorFunction = new ClrFunctionInstance(Engine, "iterator", Values, 1);
+            _originalIteratorFunction = new ClrFunction(Engine, "iterator", Values, 1);
             var symbols = new SymbolDictionary(2)
             {
                 [GlobalSymbolRegistry.Iterator] = new PropertyDescriptor(_originalIteratorFunction, PropertyFlags),

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

@@ -37,13 +37,13 @@ internal sealed class ArrayBufferConstructor : Constructor
         const PropertyFlag lengthFlags = PropertyFlag.Configurable;
         var properties = new PropertyDictionary(1, checkExistingKeys: false)
         {
-            ["isView"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunctionInstance(Engine, "isView", IsView, 1, lengthFlags), PropertyFlag.Configurable | PropertyFlag.Writable)),
+            ["isView"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunction(Engine, "isView", IsView, 1, lengthFlags), PropertyFlag.Configurable | PropertyFlag.Writable)),
         };
         SetProperties(properties);
 
         var symbols = new SymbolDictionary(1)
         {
-            [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunctionInstance(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);
     }

+ 8 - 8
Jint/Native/ArrayBuffer/ArrayBufferPrototype.cs

@@ -30,15 +30,15 @@ internal sealed class ArrayBufferPrototype : Prototype
         const PropertyFlag lengthFlags = PropertyFlag.Configurable;
         var properties = new PropertyDictionary(4, checkExistingKeys: false)
         {
-            ["byteLength"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get byteLength", ByteLength, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
+            ["byteLength"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get byteLength", ByteLength, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
             [KnownKeys.Constructor] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
-            ["detached"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get detached", Detached, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
-            ["maxByteLength"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get maxByteLength", MaxByteLength, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
-            ["resizable"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get resizable", Resizable, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
-            ["resize"] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "resize", Resize, 1, lengthFlags), PropertyFlag.NonEnumerable),
-            ["slice"] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "slice", Slice, 2, lengthFlags), PropertyFlag.NonEnumerable),
-            ["transfer"] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "transfer", Transfer, 0, lengthFlags), PropertyFlag.NonEnumerable),
-            ["transferToFixedLength"] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "transferToFixedLength", TransferToFixedLength, 0, lengthFlags), PropertyFlag.NonEnumerable),
+            ["detached"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get detached", Detached, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
+            ["maxByteLength"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get maxByteLength", MaxByteLength, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
+            ["resizable"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get resizable", Resizable, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
+            ["resize"] = new PropertyDescriptor(new ClrFunction(_engine, "resize", Resize, 1, lengthFlags), PropertyFlag.NonEnumerable),
+            ["slice"] = new PropertyDescriptor(new ClrFunction(_engine, "slice", Slice, 2, lengthFlags), PropertyFlag.NonEnumerable),
+            ["transfer"] = new PropertyDescriptor(new ClrFunction(_engine, "transfer", Transfer, 0, lengthFlags), PropertyFlag.NonEnumerable),
+            ["transferToFixedLength"] = new PropertyDescriptor(new ClrFunction(_engine, "transferToFixedLength", TransferToFixedLength, 0, lengthFlags), PropertyFlag.NonEnumerable),
         };
         SetProperties(properties);
 

+ 2 - 2
Jint/Native/BigInt/BigIntConstructor.cs

@@ -32,8 +32,8 @@ internal sealed class BigIntConstructor : Constructor
     {
         var properties = new PropertyDictionary(2, checkExistingKeys: false)
         {
-            ["asIntN"] = new(new ClrFunctionInstance(Engine, "asIntN", AsIntN, 2, PropertyFlag.Configurable), true, false, true),
-            ["asUintN"] = new(new ClrFunctionInstance(Engine, "asUintN", AsUintN, 2, PropertyFlag.Configurable), true, false, true),
+            ["asIntN"] = new(new ClrFunction(Engine, "asIntN", AsIntN, 2, PropertyFlag.Configurable), true, false, true),
+            ["asUintN"] = new(new ClrFunction(Engine, "asUintN", AsUintN, 2, PropertyFlag.Configurable), true, false, true),
         };
         SetProperties(properties);
     }

+ 3 - 3
Jint/Native/BigInt/BigIntInstance.cs

@@ -3,7 +3,7 @@ using Jint.Runtime;
 
 namespace Jint.Native.BigInt;
 
-internal sealed class BigIntInstance : ObjectInstance, IPrimitiveInstance
+internal sealed class BigIntInstance : ObjectInstance, IJsPrimitive
 {
     public BigIntInstance(Engine engine, JsBigInt value)
         : base(engine, ObjectClass.Object)
@@ -11,9 +11,9 @@ internal sealed class BigIntInstance : ObjectInstance, IPrimitiveInstance
         BigIntData = value;
     }
 
-    Types IPrimitiveInstance.Type => Types.BigInt;
+    Types IJsPrimitive.Type => Types.BigInt;
 
-    JsValue IPrimitiveInstance.PrimitiveValue => BigIntData;
+    JsValue IJsPrimitive.PrimitiveValue => BigIntData;
 
     public JsBigInt BigIntData { get; }
 }

+ 3 - 3
Jint/Native/BigInt/BigIntPrototype.cs

@@ -32,9 +32,9 @@ internal sealed class BigIntPrototype : Prototype
         var properties = new PropertyDictionary(4, checkExistingKeys: false)
         {
             ["constructor"] = new(_constructor, true, false, true),
-            ["toString"] = new(new ClrFunctionInstance(Engine, "toString", ToBigIntString, 0, PropertyFlag.Configurable), true, false, true),
-            ["toLocaleString"] = new(new ClrFunctionInstance(Engine, "toLocaleString", ToLocaleString, 0, PropertyFlag.Configurable), true, false, true),
-            ["valueOf"] = new(new ClrFunctionInstance(Engine, "valueOf", ValueOf, 0, PropertyFlag.Configurable), true, false, true),
+            ["toString"] = new(new ClrFunction(Engine, "toString", ToBigIntString, 0, PropertyFlag.Configurable), true, false, true),
+            ["toLocaleString"] = new(new ClrFunction(Engine, "toLocaleString", ToLocaleString, 0, PropertyFlag.Configurable), true, false, true),
+            ["valueOf"] = new(new ClrFunction(Engine, "valueOf", ValueOf, 0, PropertyFlag.Configurable), true, false, true),
         };
         SetProperties(properties);
 

+ 3 - 3
Jint/Native/Boolean/BooleanInstance.cs

@@ -3,7 +3,7 @@ using Jint.Runtime;
 
 namespace Jint.Native.Boolean;
 
-internal class BooleanInstance : ObjectInstance, IPrimitiveInstance
+internal class BooleanInstance : ObjectInstance, IJsPrimitive
 {
     public BooleanInstance(Engine engine, JsBoolean value)
         : base(engine, ObjectClass.Boolean)
@@ -11,9 +11,9 @@ internal class BooleanInstance : ObjectInstance, IPrimitiveInstance
         BooleanData = value;
     }
 
-    Types IPrimitiveInstance.Type => Types.Boolean;
+    Types IJsPrimitive.Type => Types.Boolean;
 
-    JsValue IPrimitiveInstance.PrimitiveValue => BooleanData;
+    JsValue IJsPrimitive.PrimitiveValue => BooleanData;
 
     public JsBoolean BooleanData { get; }
 }

+ 2 - 2
Jint/Native/Boolean/BooleanPrototype.cs

@@ -30,8 +30,8 @@ namespace Jint.Native.Boolean
             var properties = new PropertyDictionary(3, checkExistingKeys: false)
             {
                 ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
-                ["toString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toString", ToBooleanString, 0, PropertyFlag.Configurable), true, false, true),
-                ["valueOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "valueOf", ValueOf, 0, PropertyFlag.Configurable), true, false, true)
+                ["toString"] = new PropertyDescriptor(new ClrFunction(Engine, "toString", ToBooleanString, 0, PropertyFlag.Configurable), true, false, true),
+                ["valueOf"] = new PropertyDescriptor(new ClrFunction(Engine, "valueOf", ValueOf, 0, PropertyFlag.Configurable), true, false, true)
             };
             SetProperties(properties);
         }

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

@@ -33,30 +33,30 @@ namespace Jint.Native.DataView
             const PropertyFlag propertyFlags = PropertyFlag.Configurable | PropertyFlag.Writable;
             var properties = new PropertyDictionary(24, checkExistingKeys: false)
             {
-                ["buffer"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get buffer", Buffer, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
-                ["byteLength"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get byteLength", ByteLength, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
-                ["byteOffset"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(Engine, "get byteOffset", ByteOffset, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
+                ["buffer"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get buffer", Buffer, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
+                ["byteLength"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get byteLength", ByteLength, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
+                ["byteOffset"] = new GetSetPropertyDescriptor(new ClrFunction(Engine, "get byteOffset", ByteOffset, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
                 ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
-                ["getBigInt64"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getBigInt64", GetBigInt64, length: 1, lengthFlags), propertyFlags),
-                ["getBigUint64"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getBigUint64", GetBigUint64, length: 1, lengthFlags), propertyFlags),
-                ["getFloat32"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getFloat32", GetFloat32, length: 1, lengthFlags), propertyFlags),
-                ["getFloat64"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getFloat64", GetFloat64, length: 1, lengthFlags), propertyFlags),
-                ["getInt8"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getInt8", GetInt8, length: 1, lengthFlags), propertyFlags),
-                ["getInt16"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getInt16", GetInt16, length: 1, lengthFlags), propertyFlags),
-                ["getInt32"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getInt32", GetInt32, length: 1, lengthFlags), propertyFlags),
-                ["getUint8"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUint8", GetUint8, length: 1, lengthFlags), propertyFlags),
-                ["getUint16"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUint16", GetUint16, length: 1, lengthFlags), propertyFlags),
-                ["getUint32"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUint32", GetUint32, length: 1, lengthFlags), propertyFlags),
-                ["setBigInt64"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setBigInt64", SetBigInt64, length: 2, lengthFlags), propertyFlags),
-                ["setBigUint64"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setBigUint64", SetBigUint64, length: 2, lengthFlags), propertyFlags),
-                ["setFloat32"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setFloat32", SetFloat32, length: 2, lengthFlags), propertyFlags),
-                ["setFloat64"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setFloat64", SetFloat64, length: 2, lengthFlags), propertyFlags),
-                ["setInt8"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setInt8", SetInt8, length: 2, lengthFlags), propertyFlags),
-                ["setInt16"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setInt16", SetInt16, length: 2, lengthFlags), propertyFlags),
-                ["setInt32"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setInt32", SetInt32, length: 2, lengthFlags), propertyFlags),
-                ["setUint8"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setUint8", SetUint8, length: 2, lengthFlags), propertyFlags),
-                ["setUint16"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setUint16", SetUint16, length: 2, lengthFlags), propertyFlags),
-                ["setUint32"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setUint32", SetUint32, length: 2, lengthFlags), propertyFlags)
+                ["getBigInt64"] = new PropertyDescriptor(new ClrFunction(Engine, "getBigInt64", GetBigInt64, length: 1, lengthFlags), propertyFlags),
+                ["getBigUint64"] = new PropertyDescriptor(new ClrFunction(Engine, "getBigUint64", GetBigUint64, length: 1, lengthFlags), propertyFlags),
+                ["getFloat32"] = new PropertyDescriptor(new ClrFunction(Engine, "getFloat32", GetFloat32, length: 1, lengthFlags), propertyFlags),
+                ["getFloat64"] = new PropertyDescriptor(new ClrFunction(Engine, "getFloat64", GetFloat64, length: 1, lengthFlags), propertyFlags),
+                ["getInt8"] = new PropertyDescriptor(new ClrFunction(Engine, "getInt8", GetInt8, length: 1, lengthFlags), propertyFlags),
+                ["getInt16"] = new PropertyDescriptor(new ClrFunction(Engine, "getInt16", GetInt16, length: 1, lengthFlags), propertyFlags),
+                ["getInt32"] = new PropertyDescriptor(new ClrFunction(Engine, "getInt32", GetInt32, length: 1, lengthFlags), propertyFlags),
+                ["getUint8"] = new PropertyDescriptor(new ClrFunction(Engine, "getUint8", GetUint8, length: 1, lengthFlags), propertyFlags),
+                ["getUint16"] = new PropertyDescriptor(new ClrFunction(Engine, "getUint16", GetUint16, length: 1, lengthFlags), propertyFlags),
+                ["getUint32"] = new PropertyDescriptor(new ClrFunction(Engine, "getUint32", GetUint32, length: 1, lengthFlags), propertyFlags),
+                ["setBigInt64"] = new PropertyDescriptor(new ClrFunction(Engine, "setBigInt64", SetBigInt64, length: 2, lengthFlags), propertyFlags),
+                ["setBigUint64"] = new PropertyDescriptor(new ClrFunction(Engine, "setBigUint64", SetBigUint64, length: 2, lengthFlags), propertyFlags),
+                ["setFloat32"] = new PropertyDescriptor(new ClrFunction(Engine, "setFloat32", SetFloat32, length: 2, lengthFlags), propertyFlags),
+                ["setFloat64"] = new PropertyDescriptor(new ClrFunction(Engine, "setFloat64", SetFloat64, length: 2, lengthFlags), propertyFlags),
+                ["setInt8"] = new PropertyDescriptor(new ClrFunction(Engine, "setInt8", SetInt8, length: 2, lengthFlags), propertyFlags),
+                ["setInt16"] = new PropertyDescriptor(new ClrFunction(Engine, "setInt16", SetInt16, length: 2, lengthFlags), propertyFlags),
+                ["setInt32"] = new PropertyDescriptor(new ClrFunction(Engine, "setInt32", SetInt32, length: 2, lengthFlags), propertyFlags),
+                ["setUint8"] = new PropertyDescriptor(new ClrFunction(Engine, "setUint8", SetUint8, length: 2, lengthFlags), propertyFlags),
+                ["setUint16"] = new PropertyDescriptor(new ClrFunction(Engine, "setUint16", SetUint16, length: 2, lengthFlags), propertyFlags),
+                ["setUint32"] = new PropertyDescriptor(new ClrFunction(Engine, "setUint32", SetUint32, length: 2, lengthFlags), propertyFlags)
             };
             SetProperties(properties);
 

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

@@ -41,9 +41,9 @@ internal sealed class DateConstructor : Constructor
 
         var properties = new PropertyDictionary(3, checkExistingKeys: false)
         {
-            ["parse"] = new(new ClrFunctionInstance(Engine, "parse", Parse, 1, LengthFlags), PropertyFlags),
-            ["UTC"] = new(new ClrFunctionInstance(Engine, "UTC", Utc, 7, LengthFlags), PropertyFlags),
-            ["now"] = new(new ClrFunctionInstance(Engine, "now", Now, 0, LengthFlags), PropertyFlags)
+            ["parse"] = new(new ClrFunction(Engine, "parse", Parse, 1, LengthFlags), PropertyFlags),
+            ["UTC"] = new(new ClrFunction(Engine, "UTC", Utc, 7, LengthFlags), PropertyFlags),
+            ["now"] = new(new ClrFunction(Engine, "now", Now, 0, LengthFlags), PropertyFlags)
         };
         SetProperties(properties);
     }

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

@@ -45,57 +45,57 @@ namespace Jint.Native.Date
             var properties = new PropertyDictionary(50, checkExistingKeys: false)
             {
                 ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
-                ["toString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toString", ToString, 0, lengthFlags), propertyFlags),
-                ["toDateString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toDateString", ToDateString, 0, lengthFlags), propertyFlags),
-                ["toTimeString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toTimeString", ToTimeString, 0, lengthFlags), propertyFlags),
-                ["toLocaleString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toLocaleString", ToLocaleString, 0, lengthFlags), propertyFlags),
-                ["toLocaleDateString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toLocaleDateString", ToLocaleDateString, 0, lengthFlags), propertyFlags),
-                ["toLocaleTimeString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toLocaleTimeString", ToLocaleTimeString, 0, lengthFlags), propertyFlags),
-                ["valueOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "valueOf", ValueOf, 0, lengthFlags), propertyFlags),
-                ["getTime"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getTime", GetTime, 0, lengthFlags), propertyFlags),
-                ["getFullYear"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getFullYear", GetFullYear, 0, lengthFlags), propertyFlags),
-                ["getYear"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getYear", GetYear, 0, lengthFlags), propertyFlags),
-                ["getUTCFullYear"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUTCFullYear", GetUTCFullYear, 0, lengthFlags), propertyFlags),
-                ["getMonth"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getMonth", GetMonth, 0, lengthFlags), propertyFlags),
-                ["getUTCMonth"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUTCMonth", GetUTCMonth, 0, lengthFlags), propertyFlags),
-                ["getDate"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getDate", GetDate, 0, lengthFlags), propertyFlags),
-                ["getUTCDate"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUTCDate", GetUTCDate, 0, lengthFlags), propertyFlags),
-                ["getDay"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getDay", GetDay, 0, lengthFlags), propertyFlags),
-                ["getUTCDay"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUTCDay", GetUTCDay, 0, lengthFlags), propertyFlags),
-                ["getHours"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getHours", GetHours, 0, lengthFlags), propertyFlags),
-                ["getUTCHours"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUTCHours", GetUTCHours, 0, lengthFlags), propertyFlags),
-                ["getMinutes"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getMinutes", GetMinutes, 0, lengthFlags), propertyFlags),
-                ["getUTCMinutes"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUTCMinutes", GetUTCMinutes, 0, lengthFlags), propertyFlags),
-                ["getSeconds"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getSeconds", GetSeconds, 0, lengthFlags), propertyFlags),
-                ["getUTCSeconds"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUTCSeconds", GetUTCSeconds, 0, lengthFlags), propertyFlags),
-                ["getMilliseconds"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getMilliseconds", GetMilliseconds, 0, lengthFlags), propertyFlags),
-                ["getUTCMilliseconds"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getUTCMilliseconds", GetUTCMilliseconds, 0, lengthFlags), propertyFlags),
-                ["getTimezoneOffset"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getTimezoneOffset", GetTimezoneOffset, 0, lengthFlags), propertyFlags),
-                ["setTime"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setTime", SetTime, 1, lengthFlags), propertyFlags),
-                ["setMilliseconds"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setMilliseconds", SetMilliseconds, 1, lengthFlags), propertyFlags),
-                ["setUTCMilliseconds"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setUTCMilliseconds", SetUTCMilliseconds, 1, lengthFlags), propertyFlags),
-                ["setSeconds"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setSeconds", SetSeconds, 2, lengthFlags), propertyFlags),
-                ["setUTCSeconds"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setUTCSeconds", SetUTCSeconds, 2, lengthFlags), propertyFlags),
-                ["setMinutes"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setMinutes", SetMinutes, 3, lengthFlags), propertyFlags),
-                ["setUTCMinutes"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setUTCMinutes", SetUTCMinutes, 3, lengthFlags), propertyFlags),
-                ["setHours"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setHours", SetHours, 4, lengthFlags), propertyFlags),
-                ["setUTCHours"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setUTCHours", SetUTCHours, 4, lengthFlags), propertyFlags),
-                ["setDate"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setDate", SetDate, 1, lengthFlags), propertyFlags),
-                ["setUTCDate"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setUTCDate", SetUTCDate, 1, lengthFlags), propertyFlags),
-                ["setMonth"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setMonth", SetMonth, 2, lengthFlags), propertyFlags),
-                ["setUTCMonth"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setUTCMonth", SetUTCMonth, 2, lengthFlags), propertyFlags),
-                ["setFullYear"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setFullYear", SetFullYear, 3, lengthFlags), propertyFlags),
-                ["setYear"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setYear", SetYear, 1, lengthFlags), propertyFlags),
-                ["setUTCFullYear"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setUTCFullYear", SetUTCFullYear, 3, lengthFlags), propertyFlags),
-                ["toUTCString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toUTCString", ToUtcString, 0, lengthFlags), propertyFlags),
-                ["toISOString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toISOString", ToISOString, 0, lengthFlags), propertyFlags),
-                ["toJSON"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toJSON", ToJson, 1, lengthFlags), propertyFlags)
+                ["toString"] = new PropertyDescriptor(new ClrFunction(Engine, "toString", ToString, 0, lengthFlags), propertyFlags),
+                ["toDateString"] = new PropertyDescriptor(new ClrFunction(Engine, "toDateString", ToDateString, 0, lengthFlags), propertyFlags),
+                ["toTimeString"] = new PropertyDescriptor(new ClrFunction(Engine, "toTimeString", ToTimeString, 0, lengthFlags), propertyFlags),
+                ["toLocaleString"] = new PropertyDescriptor(new ClrFunction(Engine, "toLocaleString", ToLocaleString, 0, lengthFlags), propertyFlags),
+                ["toLocaleDateString"] = new PropertyDescriptor(new ClrFunction(Engine, "toLocaleDateString", ToLocaleDateString, 0, lengthFlags), propertyFlags),
+                ["toLocaleTimeString"] = new PropertyDescriptor(new ClrFunction(Engine, "toLocaleTimeString", ToLocaleTimeString, 0, lengthFlags), propertyFlags),
+                ["valueOf"] = new PropertyDescriptor(new ClrFunction(Engine, "valueOf", ValueOf, 0, lengthFlags), propertyFlags),
+                ["getTime"] = new PropertyDescriptor(new ClrFunction(Engine, "getTime", GetTime, 0, lengthFlags), propertyFlags),
+                ["getFullYear"] = new PropertyDescriptor(new ClrFunction(Engine, "getFullYear", GetFullYear, 0, lengthFlags), propertyFlags),
+                ["getYear"] = new PropertyDescriptor(new ClrFunction(Engine, "getYear", GetYear, 0, lengthFlags), propertyFlags),
+                ["getUTCFullYear"] = new PropertyDescriptor(new ClrFunction(Engine, "getUTCFullYear", GetUTCFullYear, 0, lengthFlags), propertyFlags),
+                ["getMonth"] = new PropertyDescriptor(new ClrFunction(Engine, "getMonth", GetMonth, 0, lengthFlags), propertyFlags),
+                ["getUTCMonth"] = new PropertyDescriptor(new ClrFunction(Engine, "getUTCMonth", GetUTCMonth, 0, lengthFlags), propertyFlags),
+                ["getDate"] = new PropertyDescriptor(new ClrFunction(Engine, "getDate", GetDate, 0, lengthFlags), propertyFlags),
+                ["getUTCDate"] = new PropertyDescriptor(new ClrFunction(Engine, "getUTCDate", GetUTCDate, 0, lengthFlags), propertyFlags),
+                ["getDay"] = new PropertyDescriptor(new ClrFunction(Engine, "getDay", GetDay, 0, lengthFlags), propertyFlags),
+                ["getUTCDay"] = new PropertyDescriptor(new ClrFunction(Engine, "getUTCDay", GetUTCDay, 0, lengthFlags), propertyFlags),
+                ["getHours"] = new PropertyDescriptor(new ClrFunction(Engine, "getHours", GetHours, 0, lengthFlags), propertyFlags),
+                ["getUTCHours"] = new PropertyDescriptor(new ClrFunction(Engine, "getUTCHours", GetUTCHours, 0, lengthFlags), propertyFlags),
+                ["getMinutes"] = new PropertyDescriptor(new ClrFunction(Engine, "getMinutes", GetMinutes, 0, lengthFlags), propertyFlags),
+                ["getUTCMinutes"] = new PropertyDescriptor(new ClrFunction(Engine, "getUTCMinutes", GetUTCMinutes, 0, lengthFlags), propertyFlags),
+                ["getSeconds"] = new PropertyDescriptor(new ClrFunction(Engine, "getSeconds", GetSeconds, 0, lengthFlags), propertyFlags),
+                ["getUTCSeconds"] = new PropertyDescriptor(new ClrFunction(Engine, "getUTCSeconds", GetUTCSeconds, 0, lengthFlags), propertyFlags),
+                ["getMilliseconds"] = new PropertyDescriptor(new ClrFunction(Engine, "getMilliseconds", GetMilliseconds, 0, lengthFlags), propertyFlags),
+                ["getUTCMilliseconds"] = new PropertyDescriptor(new ClrFunction(Engine, "getUTCMilliseconds", GetUTCMilliseconds, 0, lengthFlags), propertyFlags),
+                ["getTimezoneOffset"] = new PropertyDescriptor(new ClrFunction(Engine, "getTimezoneOffset", GetTimezoneOffset, 0, lengthFlags), propertyFlags),
+                ["setTime"] = new PropertyDescriptor(new ClrFunction(Engine, "setTime", SetTime, 1, lengthFlags), propertyFlags),
+                ["setMilliseconds"] = new PropertyDescriptor(new ClrFunction(Engine, "setMilliseconds", SetMilliseconds, 1, lengthFlags), propertyFlags),
+                ["setUTCMilliseconds"] = new PropertyDescriptor(new ClrFunction(Engine, "setUTCMilliseconds", SetUTCMilliseconds, 1, lengthFlags), propertyFlags),
+                ["setSeconds"] = new PropertyDescriptor(new ClrFunction(Engine, "setSeconds", SetSeconds, 2, lengthFlags), propertyFlags),
+                ["setUTCSeconds"] = new PropertyDescriptor(new ClrFunction(Engine, "setUTCSeconds", SetUTCSeconds, 2, lengthFlags), propertyFlags),
+                ["setMinutes"] = new PropertyDescriptor(new ClrFunction(Engine, "setMinutes", SetMinutes, 3, lengthFlags), propertyFlags),
+                ["setUTCMinutes"] = new PropertyDescriptor(new ClrFunction(Engine, "setUTCMinutes", SetUTCMinutes, 3, lengthFlags), propertyFlags),
+                ["setHours"] = new PropertyDescriptor(new ClrFunction(Engine, "setHours", SetHours, 4, lengthFlags), propertyFlags),
+                ["setUTCHours"] = new PropertyDescriptor(new ClrFunction(Engine, "setUTCHours", SetUTCHours, 4, lengthFlags), propertyFlags),
+                ["setDate"] = new PropertyDescriptor(new ClrFunction(Engine, "setDate", SetDate, 1, lengthFlags), propertyFlags),
+                ["setUTCDate"] = new PropertyDescriptor(new ClrFunction(Engine, "setUTCDate", SetUTCDate, 1, lengthFlags), propertyFlags),
+                ["setMonth"] = new PropertyDescriptor(new ClrFunction(Engine, "setMonth", SetMonth, 2, lengthFlags), propertyFlags),
+                ["setUTCMonth"] = new PropertyDescriptor(new ClrFunction(Engine, "setUTCMonth", SetUTCMonth, 2, lengthFlags), propertyFlags),
+                ["setFullYear"] = new PropertyDescriptor(new ClrFunction(Engine, "setFullYear", SetFullYear, 3, lengthFlags), propertyFlags),
+                ["setYear"] = new PropertyDescriptor(new ClrFunction(Engine, "setYear", SetYear, 1, lengthFlags), propertyFlags),
+                ["setUTCFullYear"] = new PropertyDescriptor(new ClrFunction(Engine, "setUTCFullYear", SetUTCFullYear, 3, lengthFlags), propertyFlags),
+                ["toUTCString"] = new PropertyDescriptor(new ClrFunction(Engine, "toUTCString", ToUtcString, 0, lengthFlags), propertyFlags),
+                ["toISOString"] = new PropertyDescriptor(new ClrFunction(Engine, "toISOString", ToISOString, 0, lengthFlags), propertyFlags),
+                ["toJSON"] = new PropertyDescriptor(new ClrFunction(Engine, "toJSON", ToJson, 1, lengthFlags), propertyFlags)
             };
             SetProperties(properties);
 
             var symbols = new SymbolDictionary(1)
             {
-                [GlobalSymbolRegistry.ToPrimitive] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "[Symbol.toPrimitive]", ToPrimitive, 1, PropertyFlag.Configurable), PropertyFlag.Configurable),
+                [GlobalSymbolRegistry.ToPrimitive] = new PropertyDescriptor(new ClrFunction(Engine, "[Symbol.toPrimitive]", ToPrimitive, 1, PropertyFlag.Configurable), PropertyFlag.Configurable),
             };
             SetSymbols(symbols);
         }

+ 1 - 1
Jint/Native/Error/ErrorPrototype.cs

@@ -36,7 +36,7 @@ namespace Jint.Native.Error
                 ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
                 ["message"] = new PropertyDescriptor("", PropertyFlag.Configurable | PropertyFlag.Writable),
                 ["name"] = new PropertyDescriptor(_name, PropertyFlag.Configurable | PropertyFlag.Writable),
-                ["toString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toString", ToString, 0, PropertyFlag.Configurable), PropertyFlag.Configurable | PropertyFlag.Writable)
+                ["toString"] = new PropertyDescriptor(new ClrFunction(Engine, "toString", ToString, 0, PropertyFlag.Configurable), PropertyFlag.Configurable | PropertyFlag.Writable)
             };
             SetProperties(properties);
         }

+ 1 - 1
Jint/Native/FinalizationRegistry/FinalizationRegistryPrototype.cs

@@ -29,7 +29,7 @@ internal sealed class FinalizationRegistryPrototype : Prototype
         const PropertyFlag PropertyFlags = PropertyFlag.NonEnumerable;
         var properties = new PropertyDictionary(4, checkExistingKeys: false)
         {
-            [KnownKeys.Constructor] = new(_constructor, PropertyFlag.NonEnumerable), ["register"] = new(new ClrFunctionInstance(Engine, "register", Register, 2, PropertyFlag.Configurable), PropertyFlags), ["unregister"] = new(new ClrFunctionInstance(Engine, "unregister", Unregister, 1, PropertyFlag.Configurable), PropertyFlags), ["cleanupSome"] = new(new ClrFunctionInstance(Engine, "cleanupSome", CleanupSome, 0, PropertyFlag.Configurable), PropertyFlags),
+            [KnownKeys.Constructor] = new(_constructor, PropertyFlag.NonEnumerable), ["register"] = new(new ClrFunction(Engine, "register", Register, 2, PropertyFlag.Configurable), PropertyFlags), ["unregister"] = new(new ClrFunction(Engine, "unregister", Unregister, 1, PropertyFlag.Configurable), PropertyFlags), ["cleanupSome"] = new(new ClrFunction(Engine, "cleanupSome", CleanupSome, 0, PropertyFlag.Configurable), PropertyFlags),
         };
         SetProperties(properties);
 

+ 2 - 2
Jint/Native/Function/BindFunctionInstance.cs → Jint/Native/Function/BindFunction.cs

@@ -6,11 +6,11 @@ namespace Jint.Native.Function
     /// <summary>
     /// https://tc39.es/ecma262/#sec-bound-function-exotic-objects
     /// </summary>
-    public sealed class BindFunctionInstance : ObjectInstance, IConstructor, ICallable
+    public sealed class BindFunction : ObjectInstance, IConstructor, ICallable
     {
         private readonly Realm _realm;
 
-        public BindFunctionInstance(Engine engine,
+        public BindFunction(Engine engine,
             Realm realm,
             ObjectInstance? proto,
             ObjectInstance targetFunction,

+ 3 - 3
Jint/Native/Function/ClassDefinition.cs

@@ -138,7 +138,7 @@ internal sealed class ClassDefinition
         engine.UpdateLexicalEnvironment(classEnv);
         engine.UpdatePrivateEnvironment(classPrivateEnvironment);
 
-        ScriptFunctionInstance F;
+        ScriptFunction F;
         try
         {
             var constructorInfo = constructor.DefineMethod(proto, constructorParent);
@@ -258,7 +258,7 @@ internal sealed class ClassDefinition
     {
         var name = fieldDefinition.GetKey(engine);
 
-        ScriptFunctionInstance? initializer = null;
+        ScriptFunction? initializer = null;
         if (fieldDefinition.Value is not null)
         {
             var intrinsics = engine.Realm.Intrinsics;
@@ -412,7 +412,7 @@ internal sealed class ClassDefinition
     /// <summary>
     /// https://tc39.es/ecma262/#sec-definemethodproperty
     /// </summary>
-    private static PrivateElement? DefineMethodProperty(ObjectInstance homeObject, JsValue key, ScriptFunctionInstance closure, bool enumerable)
+    private static PrivateElement? DefineMethodProperty(ObjectInstance homeObject, JsValue key, ScriptFunction closure, bool enumerable)
     {
         if (key.IsPrivateName())
         {

+ 1 - 1
Jint/Native/Function/EvalFunctionInstance.cs

@@ -69,7 +69,7 @@ internal sealed class EvalFunctionInstance : FunctionInstance
                     inDerivedConstructor = true;
                 }
 
-                var classFieldInitializerName = (F as ScriptFunctionInstance)?._classFieldInitializerName;
+                var classFieldInitializerName = (F as ScriptFunction)?._classFieldInitializerName;
                 if (!string.IsNullOrEmpty(classFieldInitializerName?.ToString()))
                 {
                     inClassFieldInitializer = true;

+ 3 - 3
Jint/Native/Function/FunctionConstructor.cs

@@ -68,7 +68,7 @@ namespace Jint.Native.Function
         /// <summary>
         /// https://tc39.es/ecma262/#sec-runtime-semantics-instantiateasyncfunctionobject
         /// </summary>
-        private ScriptFunctionInstance InstantiateAsyncFunctionObject(
+        private ScriptFunction InstantiateAsyncFunctionObject(
             JintFunctionDefinition functionDeclaration,
             Environment env,
             PrivateEnvironment? privateEnv)
@@ -88,7 +88,7 @@ namespace Jint.Native.Function
         /// <summary>
         /// https://tc39.es/ecma262/#sec-runtime-semantics-instantiateordinaryfunctionobject
         /// </summary>
-        private ScriptFunctionInstance InstantiateOrdinaryFunctionObject(
+        private ScriptFunction InstantiateOrdinaryFunctionObject(
             JintFunctionDefinition functionDeclaration,
             Environment env,
             PrivateEnvironment? privateEnv)
@@ -109,7 +109,7 @@ namespace Jint.Native.Function
         /// <summary>
         /// https://tc39.es/ecma262/#sec-runtime-semantics-instantiategeneratorfunctionobject
         /// </summary>
-        private ScriptFunctionInstance InstantiateGeneratorFunctionObject(
+        private ScriptFunction InstantiateGeneratorFunctionObject(
             JintFunctionDefinition functionDeclaration,
             Environment scope,
             PrivateEnvironment? privateScope)

+ 2 - 2
Jint/Native/Function/FunctionInstance.Dynamic.cs

@@ -182,14 +182,14 @@ public partial class FunctionInstance
     /// <summary>
     /// https://tc39.es/ecma262/#sec-ordinaryfunctioncreate
     /// </summary>
-    internal ScriptFunctionInstance OrdinaryFunctionCreate(
+    internal ScriptFunction OrdinaryFunctionCreate(
         ObjectInstance functionPrototype,
         JintFunctionDefinition function,
         FunctionThisMode thisMode,
         Environment scope,
         PrivateEnvironment? privateScope)
     {
-        return new ScriptFunctionInstance(
+        return new ScriptFunction(
             _engine,
             function,
             scope,

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

@@ -255,7 +255,7 @@ namespace Jint.Native.Function
                 return functionInstance._realm;
             }
 
-            if (obj is BindFunctionInstance bindFunctionInstance)
+            if (obj is BindFunction bindFunctionInstance)
             {
                 return GetFunctionRealm(bindFunctionInstance.BoundTargetFunction);
             }

+ 7 - 7
Jint/Native/Function/FunctionPrototype.cs

@@ -32,10 +32,10 @@ namespace Jint.Native.Function
             var properties = new PropertyDictionary(7, checkExistingKeys: false)
             {
                 ["constructor"] = new PropertyDescriptor(_realm.Intrinsics.Function, PropertyFlag.NonEnumerable),
-                ["toString"] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "toString", ToString, 0, lengthFlags), propertyFlags),
-                ["apply"] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "apply", Apply, 2, lengthFlags), propertyFlags),
-                ["call"] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "call", CallImpl, 1, lengthFlags), propertyFlags),
-                ["bind"] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "bind", Bind, 1, lengthFlags), propertyFlags),
+                ["toString"] = new PropertyDescriptor(new ClrFunction(_engine, "toString", ToString, 0, lengthFlags), propertyFlags),
+                ["apply"] = new PropertyDescriptor(new ClrFunction(_engine, "apply", Apply, 2, lengthFlags), propertyFlags),
+                ["call"] = new PropertyDescriptor(new ClrFunction(_engine, "call", CallImpl, 1, lengthFlags), propertyFlags),
+                ["bind"] = new PropertyDescriptor(new ClrFunction(_engine, "bind", Bind, 1, lengthFlags), propertyFlags),
                 ["arguments"] = new GetSetPropertyDescriptor.ThrowerPropertyDescriptor(_engine, PropertyFlag.Configurable),
                 ["caller"] = new GetSetPropertyDescriptor.ThrowerPropertyDescriptor(_engine, PropertyFlag.Configurable)
             };
@@ -43,7 +43,7 @@ namespace Jint.Native.Function
 
             var symbols = new SymbolDictionary(1)
             {
-                [GlobalSymbolRegistry.HasInstance] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "[Symbol.hasInstance]", HasInstance, 1, PropertyFlag.Configurable), PropertyFlag.AllForbidden)
+                [GlobalSymbolRegistry.HasInstance] = new PropertyDescriptor(new ClrFunction(_engine, "[Symbol.hasInstance]", HasInstance, 1, PropertyFlag.Configurable), PropertyFlag.AllForbidden)
             };
             SetSymbols(symbols);
         }
@@ -119,10 +119,10 @@ namespace Jint.Native.Function
         /// <summary>
         /// https://tc39.es/ecma262/#sec-boundfunctioncreate
         /// </summary>
-        private BindFunctionInstance BoundFunctionCreate(ObjectInstance targetFunction, JsValue boundThis, JsValue[] boundArgs)
+        private BindFunction BoundFunctionCreate(ObjectInstance targetFunction, JsValue boundThis, JsValue[] boundArgs)
         {
             var proto = targetFunction.GetPrototypeOf();
-            var obj = new BindFunctionInstance(_engine, _realm, proto, targetFunction, boundThis, boundArgs);
+            var obj = new BindFunction(_engine, _realm, proto, targetFunction, boundThis, boundArgs);
             return obj;
         }
 

+ 3 - 3
Jint/Native/Function/ScriptFunctionInstance.cs → Jint/Native/Function/ScriptFunction.cs

@@ -9,7 +9,7 @@ using Environment = Jint.Runtime.Environments.Environment;
 
 namespace Jint.Native.Function
 {
-    public sealed class ScriptFunctionInstance : FunctionInstance, IConstructor
+    public sealed class ScriptFunction : FunctionInstance, IConstructor
     {
         internal bool _isClassConstructor;
         internal JsValue? _classFieldInitializerName;
@@ -20,7 +20,7 @@ namespace Jint.Native.Function
         /// <summary>
         /// http://www.ecma-international.org/ecma-262/5.1/#sec-13.2
         /// </summary>
-        public ScriptFunctionInstance(
+        public ScriptFunction(
             Engine engine,
             IFunction functionDeclaration,
             Environment env,
@@ -35,7 +35,7 @@ namespace Jint.Native.Function
         {
         }
 
-        internal ScriptFunctionInstance(
+        internal ScriptFunction(
             Engine engine,
             JintFunctionDefinition function,
             Environment env,

+ 3 - 3
Jint/Native/Generator/GeneratorPrototype.cs

@@ -31,9 +31,9 @@ internal sealed class GeneratorPrototype : ObjectInstance
         var properties = new PropertyDictionary(4, false)
         {
             ["constructor"] = new(_constructor, PropertyFlag.Configurable),
-            ["next"] = new(new ClrFunctionInstance(Engine, "next", Next, 1, LengthFlags), PropertyFlags),
-            ["return"] = new(new ClrFunctionInstance(Engine, "return", Return, 1, LengthFlags), PropertyFlags),
-            ["throw"] = new(new ClrFunctionInstance(Engine, "throw", Throw, 1, LengthFlags), PropertyFlags)
+            ["next"] = new(new ClrFunction(Engine, "next", Next, 1, LengthFlags), PropertyFlags),
+            ["return"] = new(new ClrFunction(Engine, "return", Return, 1, LengthFlags), PropertyFlags),
+            ["throw"] = new(new ClrFunction(Engine, "throw", Throw, 1, LengthFlags), PropertyFlags)
         };
         SetProperties(properties);
 

+ 11 - 11
Jint/Native/Global/GlobalObject.Properties.cs

@@ -132,45 +132,45 @@ public partial class GlobalObject
         properties.AddDangerous(propertyNaN, _propertyDescriptorNan);
         properties.AddDangerous(propertyInfinity, _propertyDescriptorPositiveInfinity);
         properties.AddDangerous(propertyUndefined, _propertyDescriptorUndefined);
-        properties.AddDangerous(propertyParseInt, new LazyPropertyDescriptor(this, static state => new ClrFunctionInstance(((GlobalObject) state!)._engine, "parseInt", ParseInt, 2, LengthFlags), PropertyFlags));
-        properties.AddDangerous(propertyParseFloat, new LazyPropertyDescriptor(this, static state => new ClrFunctionInstance(((GlobalObject) state!)._engine, "parseFloat", ParseFloat, 1, LengthFlags), PropertyFlags));
-        properties.AddDangerous(propertyIsNaN, new LazyPropertyDescriptor(this, static state => new ClrFunctionInstance(((GlobalObject) state!)._engine, "isNaN", IsNaN, 1, LengthFlags), PropertyFlags));
-        properties.AddDangerous(propertyIsFinite, new LazyPropertyDescriptor(this, static state => new ClrFunctionInstance(((GlobalObject) state!)._engine, "isFinite", IsFinite, 1, LengthFlags), PropertyFlags));
+        properties.AddDangerous(propertyParseInt, new LazyPropertyDescriptor(this, static state => new ClrFunction(((GlobalObject) state!)._engine, "parseInt", ParseInt, 2, LengthFlags), PropertyFlags));
+        properties.AddDangerous(propertyParseFloat, new LazyPropertyDescriptor(this, static state => new ClrFunction(((GlobalObject) state!)._engine, "parseFloat", ParseFloat, 1, LengthFlags), PropertyFlags));
+        properties.AddDangerous(propertyIsNaN, new LazyPropertyDescriptor(this, static state => new ClrFunction(((GlobalObject) state!)._engine, "isNaN", IsNaN, 1, LengthFlags), PropertyFlags));
+        properties.AddDangerous(propertyIsFinite, new LazyPropertyDescriptor(this, static state => new ClrFunction(((GlobalObject) state!)._engine, "isFinite", IsFinite, 1, LengthFlags), PropertyFlags));
 
         properties.AddDangerous(propertyDecodeURI, new LazyPropertyDescriptor(this, static state =>
         {
             var global = (GlobalObject) state!;
-            return new ClrFunctionInstance(global._engine, "decodeURI", global.DecodeUri, 1, LengthFlags);
+            return new ClrFunction(global._engine, "decodeURI", global.DecodeUri, 1, LengthFlags);
         }, PropertyFlags));
 
         properties.AddDangerous(propertyDecodeURIComponent, new LazyPropertyDescriptor(this, static state =>
         {
             var global = (GlobalObject) state!;
-            return new ClrFunctionInstance(global._engine, "decodeURIComponent", global.DecodeUriComponent, 1, LengthFlags);
+            return new ClrFunction(global._engine, "decodeURIComponent", global.DecodeUriComponent, 1, LengthFlags);
         }, PropertyFlags));
 
         properties.AddDangerous(propertyEncodeURI, new LazyPropertyDescriptor(this, static state =>
         {
             var global = (GlobalObject) state!;
-            return new ClrFunctionInstance(global._engine, "encodeURI", global.EncodeUri, 1, LengthFlags);
+            return new ClrFunction(global._engine, "encodeURI", global.EncodeUri, 1, LengthFlags);
         }, PropertyFlags));
 
         properties.AddDangerous(propertyEncodeURIComponent, new LazyPropertyDescriptor(this, static state =>
         {
             var global = (GlobalObject) state!;
-            return new ClrFunctionInstance(global._engine, "encodeURIComponent", global.EncodeUriComponent, 1, LengthFlags);
+            return new ClrFunction(global._engine, "encodeURIComponent", global.EncodeUriComponent, 1, LengthFlags);
         }, PropertyFlags));
 
         properties.AddDangerous(propertyEscape, new LazyPropertyDescriptor(this, static state =>
         {
             var global = (GlobalObject) state!;
-            return new ClrFunctionInstance(global._engine, "escape", global.Escape, 1, LengthFlags);
+            return new ClrFunction(global._engine, "escape", global.Escape, 1, LengthFlags);
         }, PropertyFlags));
 
         properties.AddDangerous(propertyUnescape, new LazyPropertyDescriptor(this, static state =>
         {
             var global = (GlobalObject) state!;
-            return new ClrFunctionInstance(global._engine, "unescape", global.Unescape, 1, LengthFlags);
+            return new ClrFunction(global._engine, "unescape", global.Unescape, 1, LengthFlags);
         }, PropertyFlags));
 
         properties.AddDangerous(propertyGlobalThis, new PropertyDescriptor(this, PropertyFlags));
@@ -180,7 +180,7 @@ public partial class GlobalObject
         properties.AddDangerous(propertyToString, new LazyPropertyDescriptor(this, static state =>
         {
             var global = (GlobalObject) state!;
-            return new ClrFunctionInstance(global._engine, "toString", global.ToStringString, 1);
+            return new ClrFunction(global._engine, "toString", global.ToStringString, 1);
         }, PropertyFlags));
 
         SetProperties(properties);

+ 1 - 1
Jint/Native/IPrimitiveInstance.cs → Jint/Native/IJsPrimitive.cs

@@ -2,7 +2,7 @@ using Jint.Runtime;
 
 namespace Jint.Native;
 
-public interface IPrimitiveInstance
+public interface IJsPrimitive
 {
     Types Type { get; }
     JsValue PrimitiveValue { get; }

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

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

+ 1 - 1
Jint/Native/Iterator/IteratorPrototype.cs

@@ -23,7 +23,7 @@ internal class IteratorPrototype : Prototype
     {
         var symbols = new SymbolDictionary(1)
         {
-            [GlobalSymbolRegistry.Iterator] = new(new ClrFunctionInstance(Engine, "[Symbol.iterator]", ToIterator, 0, PropertyFlag.Configurable), true, false, true),
+            [GlobalSymbolRegistry.Iterator] = new(new ClrFunction(Engine, "[Symbol.iterator]", ToIterator, 0, PropertyFlag.Configurable), true, false, true),
         };
         SetSymbols(symbols);
     }

+ 5 - 7
Jint/Native/Json/JsonInstance.cs

@@ -7,7 +7,7 @@ using Jint.Runtime.Interop;
 
 namespace Jint.Native.Json
 {
-    public sealed class JsonInstance : ObjectInstance
+    internal sealed class JsonInstance : ObjectInstance
     {
         private readonly Realm _realm;
 
@@ -26,8 +26,8 @@ namespace Jint.Native.Json
             var properties = new PropertyDictionary(2, checkExistingKeys: false)
             {
 #pragma warning disable 618
-                ["parse"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "parse", Parse, 2, PropertyFlag.Configurable), true, false, true),
-                ["stringify"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "stringify", Stringify, 3, PropertyFlag.Configurable), true, false, true)
+                ["parse"] = new PropertyDescriptor(new ClrFunction(Engine, "parse", Parse, 2, PropertyFlag.Configurable), true, false, true),
+                ["stringify"] = new PropertyDescriptor(new ClrFunction(Engine, "stringify", Stringify, 3, PropertyFlag.Configurable), true, false, true)
 #pragma warning restore 618
             };
             SetProperties(properties);
@@ -87,8 +87,7 @@ namespace Jint.Native.Json
         /// <summary>
         /// https://tc39.es/ecma262/#sec-json.parse
         /// </summary>
-        [Obsolete("Method will be made private, use JsonParser directly")]
-        public JsValue Parse(JsValue thisObject, JsValue[] arguments)
+        private JsValue Parse(JsValue thisObject, JsValue[] arguments)
         {
             var jsonString = TypeConverter.ToString(arguments.At(0));
             var reviver = arguments.At(1);
@@ -109,8 +108,7 @@ namespace Jint.Native.Json
             }
         }
 
-        [Obsolete("Method will be made private, use JsonSerializer directly")]
-        public JsValue Stringify(JsValue thisObject, JsValue[] arguments)
+        private JsValue Stringify(JsValue thisObject, JsValue[] arguments)
         {
             var value = arguments.At(0);
             var replacer = arguments.At(1);

+ 2 - 2
Jint/Native/Map/MapConstructor.cs

@@ -35,13 +35,13 @@ internal sealed class MapConstructor : Constructor
         const PropertyFlag PropertyFlags = PropertyFlag.Writable | PropertyFlag.Configurable;
         var properties = new PropertyDictionary(1, checkExistingKeys: false)
         {
-            ["groupBy"] = new(new ClrFunctionInstance(Engine, "groupBy", GroupBy, 2, PropertyFlag.Configurable), PropertyFlags),
+            ["groupBy"] = new(new ClrFunction(Engine, "groupBy", GroupBy, 2, PropertyFlag.Configurable), PropertyFlags),
         };
         SetProperties(properties);
 
         var symbols = new SymbolDictionary(1)
         {
-            [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunctionInstance(_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);
     }

+ 1 - 1
Jint/Native/Map/MapIteratorPrototype.cs

@@ -24,7 +24,7 @@ internal sealed class MapIteratorPrototype : IteratorPrototype
     {
         var properties = new PropertyDictionary(1, checkExistingKeys: false)
         {
-            [KnownKeys.Next] = new(new ClrFunctionInstance(Engine, "next", Next, 0, PropertyFlag.Configurable), true, false, true)
+            [KnownKeys.Next] = new(new ClrFunction(Engine, "next", Next, 0, PropertyFlag.Configurable), true, false, true)
         };
         SetProperties(properties);
 

+ 11 - 11
Jint/Native/Map/MapPrototype.cs

@@ -33,22 +33,22 @@ internal sealed class MapPrototype : Prototype
         {
             ["length"] = new PropertyDescriptor(0, PropertyFlag.Configurable),
             ["constructor"] = new PropertyDescriptor(_mapConstructor, PropertyFlag.NonEnumerable),
-            ["clear"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "clear", Clear, 0, PropertyFlag.Configurable), propertyFlags),
-            ["delete"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "delete", Delete, 1, PropertyFlag.Configurable), propertyFlags),
-            ["entries"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "entries", Entries, 0, PropertyFlag.Configurable), propertyFlags),
-            ["forEach"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "forEach", ForEach, 1, PropertyFlag.Configurable), propertyFlags),
-            ["get"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "get", Get, 1, PropertyFlag.Configurable), propertyFlags),
-            ["has"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "has", Has, 1, PropertyFlag.Configurable), propertyFlags),
-            ["keys"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "keys", Keys, 0, PropertyFlag.Configurable), propertyFlags),
-            ["set"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "set", Set, 2, PropertyFlag.Configurable), propertyFlags),
-            ["values"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "values", Values, 0, PropertyFlag.Configurable), propertyFlags),
-            ["size"] = new GetSetPropertyDescriptor(get: new ClrFunctionInstance(Engine, "get size", Size, 0, PropertyFlag.Configurable), set: null, PropertyFlag.Configurable)
+            ["clear"] = new PropertyDescriptor(new ClrFunction(Engine, "clear", Clear, 0, PropertyFlag.Configurable), propertyFlags),
+            ["delete"] = new PropertyDescriptor(new ClrFunction(Engine, "delete", Delete, 1, PropertyFlag.Configurable), propertyFlags),
+            ["entries"] = new PropertyDescriptor(new ClrFunction(Engine, "entries", Entries, 0, PropertyFlag.Configurable), propertyFlags),
+            ["forEach"] = new PropertyDescriptor(new ClrFunction(Engine, "forEach", ForEach, 1, PropertyFlag.Configurable), propertyFlags),
+            ["get"] = new PropertyDescriptor(new ClrFunction(Engine, "get", Get, 1, PropertyFlag.Configurable), propertyFlags),
+            ["has"] = new PropertyDescriptor(new ClrFunction(Engine, "has", Has, 1, PropertyFlag.Configurable), propertyFlags),
+            ["keys"] = new PropertyDescriptor(new ClrFunction(Engine, "keys", Keys, 0, PropertyFlag.Configurable), propertyFlags),
+            ["set"] = new PropertyDescriptor(new ClrFunction(Engine, "set", Set, 2, PropertyFlag.Configurable), propertyFlags),
+            ["values"] = new PropertyDescriptor(new ClrFunction(Engine, "values", Values, 0, PropertyFlag.Configurable), propertyFlags),
+            ["size"] = new GetSetPropertyDescriptor(get: new ClrFunction(Engine, "get size", Size, 0, PropertyFlag.Configurable), set: null, PropertyFlag.Configurable)
         };
         SetProperties(properties);
 
         var symbols = new SymbolDictionary(2)
         {
-            [GlobalSymbolRegistry.Iterator] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "iterator", Entries, 1, PropertyFlag.Configurable), propertyFlags),
+            [GlobalSymbolRegistry.Iterator] = new PropertyDescriptor(new ClrFunction(Engine, "iterator", Entries, 1, PropertyFlag.Configurable), propertyFlags),
             [GlobalSymbolRegistry.ToStringTag] = new PropertyDescriptor("Map", false, false, true),
         };
         SetSymbols(symbols);

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

@@ -21,41 +21,41 @@ namespace Jint.Native.Math
         {
             var properties = new PropertyDictionary(45, checkExistingKeys: false)
             {
-                ["abs"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "abs", Abs, 1, PropertyFlag.Configurable), true, false, true),
-                ["acos"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "acos", Acos, 1, PropertyFlag.Configurable), true, false, true),
-                ["acosh"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "acosh", Acosh, 1, PropertyFlag.Configurable), true, false, true),
-                ["asin"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "asin", Asin, 1, PropertyFlag.Configurable), true, false, true),
-                ["asinh"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "asinh", Asinh, 1, PropertyFlag.Configurable), true, false, true),
-                ["atan"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "atan", Atan, 1, PropertyFlag.Configurable), true, false, true),
-                ["atanh"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "atanh", Atanh, 1, PropertyFlag.Configurable), true, false, true),
-                ["atan2"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "atan2", Atan2, 2, PropertyFlag.Configurable), true, false, true),
-                ["ceil"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "ceil", Ceil, 1, PropertyFlag.Configurable), true, false, true),
-                ["cos"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "cos", Cos, 1, PropertyFlag.Configurable), true, false, true),
-                ["cosh"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "cosh", Cosh, 1, PropertyFlag.Configurable), true, false, true),
-                ["exp"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "exp", Exp, 1, PropertyFlag.Configurable), true, false, true),
-                ["expm1"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "expm1", Expm1, 1, PropertyFlag.Configurable), true, false, true),
-                ["floor"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "floor", Floor, 1, PropertyFlag.Configurable), true, false, true),
-                ["log"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "log", Log, 1, PropertyFlag.Configurable), true, false, true),
-                ["log1p"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "log1p", Log1p, 1, PropertyFlag.Configurable), true, false, true),
-                ["log2"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "log2", Log2, 1, PropertyFlag.Configurable), true, false, true),
-                ["log10"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "log10", Log10, 1, PropertyFlag.Configurable), true, false, true),
-                ["max"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "max", Max, 2, PropertyFlag.Configurable), true, false, true),
-                ["min"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "min", Min, 2, PropertyFlag.Configurable), true, false, true),
-                ["pow"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "pow", Pow, 2, PropertyFlag.Configurable), true, false, true),
-                ["random"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "random", Random, 0, PropertyFlag.Configurable), true, false, true),
-                ["round"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "round", Round, 1, PropertyFlag.Configurable), true, false, true),
-                ["fround"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "fround", Fround, 1, PropertyFlag.Configurable), true, false, true),
-                ["sin"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "sin", Sin, 1, PropertyFlag.Configurable), true, false, true),
-                ["sinh"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "sinh", Sinh, 1, PropertyFlag.Configurable), true, false, true),
-                ["sqrt"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "sqrt", Sqrt, 1, PropertyFlag.Configurable), true, false, true),
-                ["tan"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "tan", Tan, 1, PropertyFlag.Configurable), true, false, true),
-                ["tanh"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "tanh", Tanh, 1, PropertyFlag.Configurable), true, false, true),
-                ["trunc"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "trunc", Truncate, 1, PropertyFlag.Configurable), true, false, true),
-                ["sign"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "sign", Sign, 1, PropertyFlag.Configurable), true, false, true),
-                ["cbrt"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "cbrt", Cbrt, 1, PropertyFlag.Configurable), true, false, true),
-                ["hypot"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "hypot", Hypot, 2, PropertyFlag.Configurable), true, false, true),
-                ["imul"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "imul", Imul, 2, PropertyFlag.Configurable), true, false, true),
-                ["clz32"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "clz32", Clz32, 1, PropertyFlag.Configurable), true, false, true),
+                ["abs"] = new PropertyDescriptor(new ClrFunction(Engine, "abs", Abs, 1, PropertyFlag.Configurable), true, false, true),
+                ["acos"] = new PropertyDescriptor(new ClrFunction(Engine, "acos", Acos, 1, PropertyFlag.Configurable), true, false, true),
+                ["acosh"] = new PropertyDescriptor(new ClrFunction(Engine, "acosh", Acosh, 1, PropertyFlag.Configurable), true, false, true),
+                ["asin"] = new PropertyDescriptor(new ClrFunction(Engine, "asin", Asin, 1, PropertyFlag.Configurable), true, false, true),
+                ["asinh"] = new PropertyDescriptor(new ClrFunction(Engine, "asinh", Asinh, 1, PropertyFlag.Configurable), true, false, true),
+                ["atan"] = new PropertyDescriptor(new ClrFunction(Engine, "atan", Atan, 1, PropertyFlag.Configurable), true, false, true),
+                ["atanh"] = new PropertyDescriptor(new ClrFunction(Engine, "atanh", Atanh, 1, PropertyFlag.Configurable), true, false, true),
+                ["atan2"] = new PropertyDescriptor(new ClrFunction(Engine, "atan2", Atan2, 2, PropertyFlag.Configurable), true, false, true),
+                ["ceil"] = new PropertyDescriptor(new ClrFunction(Engine, "ceil", Ceil, 1, PropertyFlag.Configurable), true, false, true),
+                ["cos"] = new PropertyDescriptor(new ClrFunction(Engine, "cos", Cos, 1, PropertyFlag.Configurable), true, false, true),
+                ["cosh"] = new PropertyDescriptor(new ClrFunction(Engine, "cosh", Cosh, 1, PropertyFlag.Configurable), true, false, true),
+                ["exp"] = new PropertyDescriptor(new ClrFunction(Engine, "exp", Exp, 1, PropertyFlag.Configurable), true, false, true),
+                ["expm1"] = new PropertyDescriptor(new ClrFunction(Engine, "expm1", Expm1, 1, PropertyFlag.Configurable), true, false, true),
+                ["floor"] = new PropertyDescriptor(new ClrFunction(Engine, "floor", Floor, 1, PropertyFlag.Configurable), true, false, true),
+                ["log"] = new PropertyDescriptor(new ClrFunction(Engine, "log", Log, 1, PropertyFlag.Configurable), true, false, true),
+                ["log1p"] = new PropertyDescriptor(new ClrFunction(Engine, "log1p", Log1p, 1, PropertyFlag.Configurable), true, false, true),
+                ["log2"] = new PropertyDescriptor(new ClrFunction(Engine, "log2", Log2, 1, PropertyFlag.Configurable), true, false, true),
+                ["log10"] = new PropertyDescriptor(new ClrFunction(Engine, "log10", Log10, 1, PropertyFlag.Configurable), true, false, true),
+                ["max"] = new PropertyDescriptor(new ClrFunction(Engine, "max", Max, 2, PropertyFlag.Configurable), true, false, true),
+                ["min"] = new PropertyDescriptor(new ClrFunction(Engine, "min", Min, 2, PropertyFlag.Configurable), true, false, true),
+                ["pow"] = new PropertyDescriptor(new ClrFunction(Engine, "pow", Pow, 2, PropertyFlag.Configurable), true, false, true),
+                ["random"] = new PropertyDescriptor(new ClrFunction(Engine, "random", Random, 0, PropertyFlag.Configurable), true, false, true),
+                ["round"] = new PropertyDescriptor(new ClrFunction(Engine, "round", Round, 1, PropertyFlag.Configurable), true, false, true),
+                ["fround"] = new PropertyDescriptor(new ClrFunction(Engine, "fround", Fround, 1, PropertyFlag.Configurable), true, false, true),
+                ["sin"] = new PropertyDescriptor(new ClrFunction(Engine, "sin", Sin, 1, PropertyFlag.Configurable), true, false, true),
+                ["sinh"] = new PropertyDescriptor(new ClrFunction(Engine, "sinh", Sinh, 1, PropertyFlag.Configurable), true, false, true),
+                ["sqrt"] = new PropertyDescriptor(new ClrFunction(Engine, "sqrt", Sqrt, 1, PropertyFlag.Configurable), true, false, true),
+                ["tan"] = new PropertyDescriptor(new ClrFunction(Engine, "tan", Tan, 1, PropertyFlag.Configurable), true, false, true),
+                ["tanh"] = new PropertyDescriptor(new ClrFunction(Engine, "tanh", Tanh, 1, PropertyFlag.Configurable), true, false, true),
+                ["trunc"] = new PropertyDescriptor(new ClrFunction(Engine, "trunc", Truncate, 1, PropertyFlag.Configurable), true, false, true),
+                ["sign"] = new PropertyDescriptor(new ClrFunction(Engine, "sign", Sign, 1, PropertyFlag.Configurable), true, false, true),
+                ["cbrt"] = new PropertyDescriptor(new ClrFunction(Engine, "cbrt", Cbrt, 1, PropertyFlag.Configurable), true, false, true),
+                ["hypot"] = new PropertyDescriptor(new ClrFunction(Engine, "hypot", Hypot, 2, PropertyFlag.Configurable), true, false, true),
+                ["imul"] = new PropertyDescriptor(new ClrFunction(Engine, "imul", Imul, 2, PropertyFlag.Configurable), true, false, true),
+                ["clz32"] = new PropertyDescriptor(new ClrFunction(Engine, "clz32", Clz32, 1, PropertyFlag.Configurable), true, false, true),
                 ["E"] = new PropertyDescriptor(System.Math.E, false, false, false),
                 ["LN10"] = new PropertyDescriptor(System.Math.Log(10), false, false, false),
                 ["LN2"] = new PropertyDescriptor(System.Math.Log(2), false, false, false),

+ 6 - 6
Jint/Native/Number/NumberConstructor.cs

@@ -43,12 +43,12 @@ namespace Jint.Native.Number
                 ["EPSILON"] = new PropertyDescriptor(new PropertyDescriptor(JsNumber.JavaScriptEpsilon, PropertyFlag.AllForbidden)),
                 ["MIN_SAFE_INTEGER"] = new PropertyDescriptor(new PropertyDescriptor(MinSafeInteger, PropertyFlag.AllForbidden)),
                 ["MAX_SAFE_INTEGER"] = new PropertyDescriptor(new PropertyDescriptor(MaxSafeInteger, PropertyFlag.AllForbidden)),
-                ["isFinite"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "isFinite", IsFinite, 1, PropertyFlag.Configurable), true, false, true),
-                ["isInteger"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "isInteger", IsInteger, 1, PropertyFlag.Configurable), true, false, true),
-                ["isNaN"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "isNaN", IsNaN, 1, PropertyFlag.Configurable), true, false, true),
-                ["isSafeInteger"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "isSafeInteger", IsSafeInteger, 1, PropertyFlag.Configurable), true, false, true),
-                ["parseFloat"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "parseFloat", GlobalObject.ParseFloat, 0, PropertyFlag.Configurable), true, false, true),
-                ["parseInt"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "parseInt", GlobalObject.ParseInt, 0, PropertyFlag.Configurable), true, false, true)
+                ["isFinite"] = new PropertyDescriptor(new ClrFunction(Engine, "isFinite", IsFinite, 1, PropertyFlag.Configurable), true, false, true),
+                ["isInteger"] = new PropertyDescriptor(new ClrFunction(Engine, "isInteger", IsInteger, 1, PropertyFlag.Configurable), true, false, true),
+                ["isNaN"] = new PropertyDescriptor(new ClrFunction(Engine, "isNaN", IsNaN, 1, PropertyFlag.Configurable), true, false, true),
+                ["isSafeInteger"] = new PropertyDescriptor(new ClrFunction(Engine, "isSafeInteger", IsSafeInteger, 1, PropertyFlag.Configurable), true, false, true),
+                ["parseFloat"] = new PropertyDescriptor(new ClrFunction(Engine, "parseFloat", GlobalObject.ParseFloat, 0, PropertyFlag.Configurable), true, false, true),
+                ["parseInt"] = new PropertyDescriptor(new ClrFunction(Engine, "parseInt", GlobalObject.ParseInt, 0, PropertyFlag.Configurable), true, false, true)
             };
             SetProperties(properties);
         }

+ 3 - 3
Jint/Native/Number/NumberInstance.cs

@@ -4,7 +4,7 @@ using Jint.Runtime;
 
 namespace Jint.Native.Number;
 
-internal class NumberInstance : ObjectInstance, IPrimitiveInstance
+internal class NumberInstance : ObjectInstance, IJsPrimitive
 {
     private static readonly long NegativeZeroBits = BitConverter.DoubleToInt64Bits(-0.0);
 
@@ -20,9 +20,9 @@ internal class NumberInstance : ObjectInstance, IPrimitiveInstance
         NumberData = value;
     }
 
-    Types IPrimitiveInstance.Type => Types.Number;
+    Types IJsPrimitive.Type => Types.Number;
 
-    JsValue IPrimitiveInstance.PrimitiveValue => NumberData;
+    JsValue IJsPrimitive.PrimitiveValue => NumberData;
 
     public JsNumber NumberData { get; }
 

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

@@ -38,12 +38,12 @@ namespace Jint.Native.Number
             var properties = new PropertyDictionary(8, checkExistingKeys: false)
             {
                 ["constructor"] = new PropertyDescriptor(_constructor, true, false, true),
-                ["toString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toString", ToNumberString, 1, PropertyFlag.Configurable), true, false, true),
-                ["toLocaleString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toLocaleString", ToLocaleString, 0, PropertyFlag.Configurable), true, false, true),
-                ["valueOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "valueOf", ValueOf, 0, PropertyFlag.Configurable), true, false, true),
-                ["toFixed"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toFixed", ToFixed, 1, PropertyFlag.Configurable), true, false, true),
-                ["toExponential"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toExponential", ToExponential, 1, PropertyFlag.Configurable), true, false, true),
-                ["toPrecision"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toPrecision", ToPrecision, 1, PropertyFlag.Configurable), true, false, true)
+                ["toString"] = new PropertyDescriptor(new ClrFunction(Engine, "toString", ToNumberString, 1, PropertyFlag.Configurable), true, false, true),
+                ["toLocaleString"] = new PropertyDescriptor(new ClrFunction(Engine, "toLocaleString", ToLocaleString, 0, PropertyFlag.Configurable), true, false, true),
+                ["valueOf"] = new PropertyDescriptor(new ClrFunction(Engine, "valueOf", ValueOf, 0, PropertyFlag.Configurable), true, false, true),
+                ["toFixed"] = new PropertyDescriptor(new ClrFunction(Engine, "toFixed", ToFixed, 1, PropertyFlag.Configurable), true, false, true),
+                ["toExponential"] = new PropertyDescriptor(new ClrFunction(Engine, "toExponential", ToExponential, 1, PropertyFlag.Configurable), true, false, true),
+                ["toPrecision"] = new PropertyDescriptor(new ClrFunction(Engine, "toPrecision", ToPrecision, 1, PropertyFlag.Configurable), true, false, true)
             };
             SetProperties(properties);
         }

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

@@ -32,29 +32,29 @@ namespace Jint.Native.Object
             const PropertyFlag LengthFlags = PropertyFlag.Configurable;
             var properties = new PropertyDictionary(16, checkExistingKeys: false)
             {
-                ["assign"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "assign", Assign, 2, LengthFlags), PropertyFlags),
-                ["entries"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "entries", Entries, 1, LengthFlags), PropertyFlags),
-                ["fromEntries"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "fromEntries", FromEntries, 1, LengthFlags), PropertyFlags),
-                ["getPrototypeOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getPrototypeOf", GetPrototypeOf, 1), PropertyFlags),
-                ["getOwnPropertyDescriptor"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getOwnPropertyDescriptor", GetOwnPropertyDescriptor, 2, LengthFlags), PropertyFlags),
-                ["getOwnPropertyDescriptors"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getOwnPropertyDescriptors", GetOwnPropertyDescriptors, 1, LengthFlags), PropertyFlags),
-                ["getOwnPropertyNames"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getOwnPropertyNames", GetOwnPropertyNames, 1), PropertyFlags),
-                ["getOwnPropertySymbols"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getOwnPropertySymbols", GetOwnPropertySymbols, 1, LengthFlags), PropertyFlags),
-                ["groupBy"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "groupBy", GroupBy, 2, PropertyFlag.Configurable), PropertyFlags),
-                ["create"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "create", Create, 2), PropertyFlags),
-                ["defineProperty"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "defineProperty", DefineProperty, 3), PropertyFlags),
-                ["defineProperties"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "defineProperties", DefineProperties, 2), PropertyFlags),
-                ["is"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "is", Is, 2, LengthFlags), PropertyFlags),
-                ["seal"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "seal", Seal, 1, LengthFlags), PropertyFlags),
-                ["freeze"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "freeze", Freeze, 1), PropertyFlags),
-                ["preventExtensions"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "preventExtensions", PreventExtensions, 1), PropertyFlags),
-                ["isSealed"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "isSealed", IsSealed, 1), PropertyFlags),
-                ["isFrozen"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "isFrozen", IsFrozen, 1), PropertyFlags),
-                ["isExtensible"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "isExtensible", IsExtensible, 1), PropertyFlags),
-                ["keys"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "keys", Keys, 1, LengthFlags), PropertyFlags),
-                ["values"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "values", Values, 1, LengthFlags), PropertyFlags),
-                ["setPrototypeOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setPrototypeOf", SetPrototypeOf, 2, LengthFlags), PropertyFlags),
-                ["hasOwn"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "hasOwn", HasOwn, 2, LengthFlags), PropertyFlags),
+                ["assign"] = new PropertyDescriptor(new ClrFunction(Engine, "assign", Assign, 2, LengthFlags), PropertyFlags),
+                ["entries"] = new PropertyDescriptor(new ClrFunction(Engine, "entries", Entries, 1, LengthFlags), PropertyFlags),
+                ["fromEntries"] = new PropertyDescriptor(new ClrFunction(Engine, "fromEntries", FromEntries, 1, LengthFlags), PropertyFlags),
+                ["getPrototypeOf"] = new PropertyDescriptor(new ClrFunction(Engine, "getPrototypeOf", GetPrototypeOf, 1), PropertyFlags),
+                ["getOwnPropertyDescriptor"] = new PropertyDescriptor(new ClrFunction(Engine, "getOwnPropertyDescriptor", GetOwnPropertyDescriptor, 2, LengthFlags), PropertyFlags),
+                ["getOwnPropertyDescriptors"] = new PropertyDescriptor(new ClrFunction(Engine, "getOwnPropertyDescriptors", GetOwnPropertyDescriptors, 1, LengthFlags), PropertyFlags),
+                ["getOwnPropertyNames"] = new PropertyDescriptor(new ClrFunction(Engine, "getOwnPropertyNames", GetOwnPropertyNames, 1), PropertyFlags),
+                ["getOwnPropertySymbols"] = new PropertyDescriptor(new ClrFunction(Engine, "getOwnPropertySymbols", GetOwnPropertySymbols, 1, LengthFlags), PropertyFlags),
+                ["groupBy"] = new PropertyDescriptor(new ClrFunction(Engine, "groupBy", GroupBy, 2, PropertyFlag.Configurable), PropertyFlags),
+                ["create"] = new PropertyDescriptor(new ClrFunction(Engine, "create", Create, 2), PropertyFlags),
+                ["defineProperty"] = new PropertyDescriptor(new ClrFunction(Engine, "defineProperty", DefineProperty, 3), PropertyFlags),
+                ["defineProperties"] = new PropertyDescriptor(new ClrFunction(Engine, "defineProperties", DefineProperties, 2), PropertyFlags),
+                ["is"] = new PropertyDescriptor(new ClrFunction(Engine, "is", Is, 2, LengthFlags), PropertyFlags),
+                ["seal"] = new PropertyDescriptor(new ClrFunction(Engine, "seal", Seal, 1, LengthFlags), PropertyFlags),
+                ["freeze"] = new PropertyDescriptor(new ClrFunction(Engine, "freeze", Freeze, 1), PropertyFlags),
+                ["preventExtensions"] = new PropertyDescriptor(new ClrFunction(Engine, "preventExtensions", PreventExtensions, 1), PropertyFlags),
+                ["isSealed"] = new PropertyDescriptor(new ClrFunction(Engine, "isSealed", IsSealed, 1), PropertyFlags),
+                ["isFrozen"] = new PropertyDescriptor(new ClrFunction(Engine, "isFrozen", IsFrozen, 1), PropertyFlags),
+                ["isExtensible"] = new PropertyDescriptor(new ClrFunction(Engine, "isExtensible", IsExtensible, 1), PropertyFlags),
+                ["keys"] = new PropertyDescriptor(new ClrFunction(Engine, "keys", Keys, 1, LengthFlags), PropertyFlags),
+                ["values"] = new PropertyDescriptor(new ClrFunction(Engine, "values", Values, 1, LengthFlags), PropertyFlags),
+                ["setPrototypeOf"] = new PropertyDescriptor(new ClrFunction(Engine, "setPrototypeOf", SetPrototypeOf, 2, LengthFlags), PropertyFlags),
+                ["hasOwn"] = new PropertyDescriptor(new ClrFunction(Engine, "hasOwn", HasOwn, 2, LengthFlags), PropertyFlags),
             };
             SetProperties(properties);
         }

+ 2 - 2
Jint/Native/Object/ObjectInstance.Private.cs

@@ -11,7 +11,7 @@ public partial class ObjectInstance
     /// <summary>
     /// https://tc39.es/ecma262/#sec-initializeinstanceelements
     /// </summary>
-    internal void InitializeInstanceElements(ScriptFunctionInstance constructor)
+    internal void InitializeInstanceElements(ScriptFunction constructor)
     {
         var methods = constructor._privateMethods;
         if (methods is not null)
@@ -139,7 +139,7 @@ public partial class ObjectInstance
 internal sealed class ClassFieldDefinition
 {
     public required JsValue Name { get; set; }
-    public ScriptFunctionInstance? Initializer { get; set; }
+    public ScriptFunction? Initializer { get; set; }
 }
 
 internal sealed class ClassStaticBlockDefinition

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

@@ -30,13 +30,13 @@ namespace Jint.Native.Object
             var properties = new PropertyDictionary(12, checkExistingKeys: false)
             {
                 ["constructor"] = new PropertyDescriptor(_constructor, propertyFlags),
-                ["__defineGetter__"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "__defineGetter__", DefineGetter, 2, lengthFlags), propertyFlags),
-                ["__defineSetter__"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "__defineSetter__", DefineSetter, 2, lengthFlags), propertyFlags),
-                ["__lookupGetter__"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "__lookupGetter__", LookupGetter, 1, lengthFlags), propertyFlags),
-                ["__lookupSetter__"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "__lookupSetter__", LookupSetter, 1, lengthFlags), propertyFlags),
+                ["__defineGetter__"] = new PropertyDescriptor(new ClrFunction(Engine, "__defineGetter__", DefineGetter, 2, lengthFlags), propertyFlags),
+                ["__defineSetter__"] = new PropertyDescriptor(new ClrFunction(Engine, "__defineSetter__", DefineSetter, 2, lengthFlags), propertyFlags),
+                ["__lookupGetter__"] = new PropertyDescriptor(new ClrFunction(Engine, "__lookupGetter__", LookupGetter, 1, lengthFlags), propertyFlags),
+                ["__lookupSetter__"] = new PropertyDescriptor(new ClrFunction(Engine, "__lookupSetter__", LookupSetter, 1, lengthFlags), propertyFlags),
                 ["__proto__"] = new GetSetPropertyDescriptor(
-                    new ClrFunctionInstance(Engine, "get __proto__", (thisObject, _) => TypeConverter.ToObject(_realm, thisObject).GetPrototypeOf() ?? Null, 0, lengthFlags),
-                    new ClrFunctionInstance(Engine, "set __proto__", (thisObject, arguments) =>
+                    new ClrFunction(Engine, "get __proto__", (thisObject, _) => TypeConverter.ToObject(_realm, thisObject).GetPrototypeOf() ?? Null, 0, lengthFlags),
+                    new ClrFunction(Engine, "set __proto__", (thisObject, arguments) =>
                     {
                         TypeConverter.CheckObjectCoercible(_engine, thisObject);
 
@@ -54,12 +54,12 @@ namespace Jint.Native.Object
                         return Undefined;
                     }, 0, lengthFlags),
                     enumerable: false, configurable: true),
-                ["toString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toString", ToObjectString, 0, lengthFlags), propertyFlags),
-                ["toLocaleString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toLocaleString", ToLocaleString, 0, lengthFlags), propertyFlags),
-                ["valueOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "valueOf", ValueOf, 0, lengthFlags), propertyFlags),
-                ["hasOwnProperty"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "hasOwnProperty", HasOwnProperty, 1, lengthFlags), propertyFlags),
-                ["isPrototypeOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "isPrototypeOf", IsPrototypeOf, 1, lengthFlags), propertyFlags),
-                ["propertyIsEnumerable"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "propertyIsEnumerable", PropertyIsEnumerable, 1, lengthFlags), propertyFlags)
+                ["toString"] = new PropertyDescriptor(new ClrFunction(Engine, "toString", ToObjectString, 0, lengthFlags), propertyFlags),
+                ["toLocaleString"] = new PropertyDescriptor(new ClrFunction(Engine, "toLocaleString", ToLocaleString, 0, lengthFlags), propertyFlags),
+                ["valueOf"] = new PropertyDescriptor(new ClrFunction(Engine, "valueOf", ValueOf, 0, lengthFlags), propertyFlags),
+                ["hasOwnProperty"] = new PropertyDescriptor(new ClrFunction(Engine, "hasOwnProperty", HasOwnProperty, 1, lengthFlags), propertyFlags),
+                ["isPrototypeOf"] = new PropertyDescriptor(new ClrFunction(Engine, "isPrototypeOf", IsPrototypeOf, 1, lengthFlags), propertyFlags),
+                ["propertyIsEnumerable"] = new PropertyDescriptor(new ClrFunction(Engine, "propertyIsEnumerable", PropertyIsEnumerable, 1, lengthFlags), propertyFlags)
             };
             SetProperties(properties);
         }

+ 2 - 2
Jint/Native/Promise/JsPromise.cs

@@ -57,7 +57,7 @@ internal sealed class JsPromise : ObjectInstance
     internal ResolvingFunctions CreateResolvingFunctions()
     {
         var alreadyResolved = false;
-        var resolve = new ClrFunctionInstance(_engine, "", (thisObj, args) =>
+        var resolve = new ClrFunction(_engine, "", (thisObj, args) =>
         {
             if (alreadyResolved)
             {
@@ -68,7 +68,7 @@ internal sealed class JsPromise : ObjectInstance
             return Resolve(thisObj, args);
         }, 1, PropertyFlag.Configurable);
 
-        var reject = new ClrFunctionInstance(_engine, "", (thisObj, args) =>
+        var reject = new ClrFunction(_engine, "", (thisObj, args) =>
         {
             if (alreadyResolved)
             {

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

@@ -42,20 +42,20 @@ namespace Jint.Native.Promise
             const PropertyFlag LengthFlags = PropertyFlag.Configurable;
             var properties = new PropertyDictionary(6, checkExistingKeys: false)
             {
-                ["all"] = new(new PropertyDescriptor(new ClrFunctionInstance(Engine, "all", All, 1, LengthFlags), PropertyFlags)),
-                ["allSettled"] = new(new PropertyDescriptor(new ClrFunctionInstance(Engine, "allSettled", AllSettled, 1, LengthFlags), PropertyFlags)),
-                ["any"] = new(new PropertyDescriptor(new ClrFunctionInstance(Engine, "any", Any, 1, LengthFlags), PropertyFlags)),
-                ["race"] = new(new PropertyDescriptor(new ClrFunctionInstance(Engine, "race", Race, 1, LengthFlags), PropertyFlags)),
-                ["reject"] = new(new PropertyDescriptor(new ClrFunctionInstance(Engine, "reject", Reject, 1, LengthFlags), PropertyFlags)),
-                ["resolve"] = new(new PropertyDescriptor(new ClrFunctionInstance(Engine, "resolve", Resolve, 1, LengthFlags), PropertyFlags)),
-                ["withResolvers"] = new(new PropertyDescriptor(new ClrFunctionInstance(Engine, "withResolvers", WithResolvers , 0, LengthFlags), PropertyFlags)),
+                ["all"] = new(new PropertyDescriptor(new ClrFunction(Engine, "all", All, 1, LengthFlags), PropertyFlags)),
+                ["allSettled"] = new(new PropertyDescriptor(new ClrFunction(Engine, "allSettled", AllSettled, 1, LengthFlags), PropertyFlags)),
+                ["any"] = new(new PropertyDescriptor(new ClrFunction(Engine, "any", Any, 1, LengthFlags), PropertyFlags)),
+                ["race"] = new(new PropertyDescriptor(new ClrFunction(Engine, "race", Race, 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)),
+                ["withResolvers"] = new(new PropertyDescriptor(new ClrFunction(Engine, "withResolvers", WithResolvers , 0, LengthFlags), PropertyFlags)),
             };
             SetProperties(properties);
 
             var symbols = new SymbolDictionary(1)
             {
                 [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(
-                    get: new ClrFunctionInstance(_engine, "get [Symbol.species]", (thisObj, _) => thisObj, 0, PropertyFlag.Configurable),
+                    get: new ClrFunction(_engine, "get [Symbol.species]", (thisObj, _) => thisObj, 0, PropertyFlag.Configurable),
                     set: Undefined, PropertyFlag.Configurable)
             };
             SetSymbols(symbols);
@@ -286,7 +286,7 @@ namespace Jint.Native.Promise
 
                         var alreadyCalled = false;
                         var onSuccess =
-                            new ClrFunctionInstance(_engine, "", (_, args) =>
+                            new ClrFunction(_engine, "", (_, args) =>
                             {
                                 if (!alreadyCalled)
                                 {
@@ -382,7 +382,7 @@ namespace Jint.Native.Promise
 
                         var alreadyCalled = false;
                         var onSuccess =
-                            new ClrFunctionInstance(_engine, "", (_, args) =>
+                            new ClrFunction(_engine, "", (_, args) =>
                             {
                                 if (!alreadyCalled)
                                 {
@@ -399,7 +399,7 @@ namespace Jint.Native.Promise
                                 return Undefined;
                             }, 1, PropertyFlag.Configurable);
                         var onFailure =
-                            new ClrFunctionInstance(_engine, "", (_, args) =>
+                            new ClrFunction(_engine, "", (_, args) =>
                             {
                                 if (!alreadyCalled)
                                 {
@@ -508,7 +508,7 @@ namespace Jint.Native.Promise
                         var alreadyCalled = false;
 
                         var onError =
-                            new ClrFunctionInstance(_engine, "", (_, args) =>
+                            new ClrFunction(_engine, "", (_, args) =>
                             {
                                 if (!alreadyCalled)
                                 {
@@ -663,7 +663,7 @@ namespace Jint.Native.Promise
                 return Undefined;
             }
 
-            var executor = new ClrFunctionInstance(engine, "", Executor, 2, PropertyFlag.Configurable);
+            var executor = new ClrFunction(engine, "", Executor, 2, PropertyFlag.Configurable);
 
             var instance = ctor.Construct(new JsValue[] { executor }, c);
 

+ 9 - 9
Jint/Native/Promise/PromisePrototype.cs

@@ -28,9 +28,9 @@ namespace Jint.Native.Promise
             var properties = new PropertyDictionary(5, checkExistingKeys: false)
             {
                 ["constructor"] = new(_constructor, PropertyFlag.NonEnumerable),
-                ["then"] = new(new ClrFunctionInstance(Engine, "then", Then, 2, lengthFlags), propertyFlags),
-                ["catch"] = new(new ClrFunctionInstance(Engine, "catch", Catch, 1, lengthFlags), propertyFlags),
-                ["finally"] = new(new ClrFunctionInstance(Engine, "finally", Finally, 1, lengthFlags), propertyFlags)
+                ["then"] = new(new ClrFunction(Engine, "then", Then, 2, lengthFlags), propertyFlags),
+                ["catch"] = new(new ClrFunction(Engine, "catch", Catch, 1, lengthFlags), propertyFlags),
+                ["finally"] = new(new ClrFunction(Engine, "finally", Finally, 1, lengthFlags), propertyFlags)
             };
             SetProperties(properties);
 
@@ -118,8 +118,8 @@ namespace Jint.Native.Promise
         }
 
         // https://tc39.es/ecma262/#sec-thenfinallyfunctions
-        private ClrFunctionInstance ThenFinallyFunctions(ICallable onFinally, IConstructor ctor) =>
-            new ClrFunctionInstance(_engine, "", (_, args) =>
+        private ClrFunction ThenFinallyFunctions(ICallable onFinally, IConstructor ctor) =>
+            new ClrFunction(_engine, "", (_, args) =>
             {
                 var value = args.At(0);
 
@@ -130,15 +130,15 @@ namespace Jint.Native.Promise
                 var promise = _realm.Intrinsics.Promise.Resolve((JsValue) ctor, new[] {result});
 
                 // 8. Let valueThunk be equivalent to a function that returns value.
-                var valueThunk = new ClrFunctionInstance(_engine, "", (_, _) => value);
+                var valueThunk = new ClrFunction(_engine, "", (_, _) => value);
 
                 // 9. Return ? Invoke(promise, "then", « valueThunk »).
                 return _engine.Invoke(promise, "then", new JsValue[] {valueThunk});
             }, 1, PropertyFlag.Configurable);
 
         // https://tc39.es/ecma262/#sec-catchfinallyfunctions
-        private ClrFunctionInstance CatchFinallyFunctions(ICallable onFinally, IConstructor ctor) =>
-            new ClrFunctionInstance(_engine, "", (_, args) =>
+        private ClrFunction CatchFinallyFunctions(ICallable onFinally, IConstructor ctor) =>
+            new ClrFunction(_engine, "", (_, args) =>
             {
                 var reason = args.At(0);
 
@@ -149,7 +149,7 @@ namespace Jint.Native.Promise
                 var promise = _realm.Intrinsics.Promise.Resolve((JsValue) ctor, new[] {result});
 
                 // 8. Let thrower be equivalent to a function that throws reason.
-                var thrower = new ClrFunctionInstance(_engine, "", (_, _) => throw new JavaScriptException(reason));
+                var thrower = new ClrFunction(_engine, "", (_, _) => throw new JavaScriptException(reason));
 
                 // 9. Return ? Invoke(promise, "then", « thrower »).
                 return _engine.Invoke(promise, "then", new JsValue[] {thrower});

+ 2 - 2
Jint/Native/Proxy/ProxyConstructor.cs

@@ -29,7 +29,7 @@ namespace Jint.Native.Proxy
         {
             var properties = new PropertyDictionary(1, checkExistingKeys: false)
             {
-                ["revocable"] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "revocable", Revocable, 2, PropertyFlag.Configurable), true, true, true)
+                ["revocable"] = new PropertyDescriptor(new ClrFunction(_engine, "revocable", Revocable, 2, PropertyFlag.Configurable), true, true, true)
             };
             SetProperties(properties);
         }
@@ -72,7 +72,7 @@ namespace Jint.Native.Proxy
             }
 
             var result = _realm.Intrinsics.Object.Construct(System.Array.Empty<JsValue>());
-            result.DefineOwnProperty(PropertyRevoke, new PropertyDescriptor(new ClrFunctionInstance(_engine, name: "", Revoke, 0, PropertyFlag.Configurable), PropertyFlag.ConfigurableEnumerableWritable));
+            result.DefineOwnProperty(PropertyRevoke, new PropertyDescriptor(new ClrFunction(_engine, name: "", Revoke, 0, PropertyFlag.Configurable), PropertyFlag.ConfigurableEnumerableWritable));
             result.DefineOwnProperty(PropertyProxy, new PropertyDescriptor(p, PropertyFlag.ConfigurableEnumerableWritable));
             return result;
         }

+ 13 - 13
Jint/Native/Reflect/ReflectInstance.cs

@@ -30,19 +30,19 @@ namespace Jint.Native.Reflect
         {
             var properties = new PropertyDictionary(14, checkExistingKeys: false)
             {
-                ["apply"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "apply", Apply, 3, PropertyFlag.Configurable), true, false, true),
-                ["construct"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "construct", Construct, 2, PropertyFlag.Configurable), true, false, true),
-                ["defineProperty"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "defineProperty", DefineProperty, 3, PropertyFlag.Configurable), true, false, true),
-                ["deleteProperty"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "deleteProperty", DeleteProperty, 2, PropertyFlag.Configurable), true, false, true),
-                ["get"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "get", Get, 2, PropertyFlag.Configurable), true, false, true),
-                ["getOwnPropertyDescriptor"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getOwnPropertyDescriptor", GetOwnPropertyDescriptor, 2, PropertyFlag.Configurable), true, false, true),
-                ["getPrototypeOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "getPrototypeOf", GetPrototypeOf, 1, PropertyFlag.Configurable), true, false, true),
-                ["has"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "has", Has, 2, PropertyFlag.Configurable), true, false, true),
-                ["isExtensible"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "isExtensible", IsExtensible, 1, PropertyFlag.Configurable), true, false, true),
-                ["ownKeys"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "ownKeys", OwnKeys, 1, PropertyFlag.Configurable), true, false, true),
-                ["preventExtensions"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "preventExtensions", PreventExtensions, 1, PropertyFlag.Configurable), true, false, true),
-                ["set"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "set", Set, 3, PropertyFlag.Configurable), true, false, true),
-                ["setPrototypeOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "setPrototypeOf", SetPrototypeOf, 2, PropertyFlag.Configurable), true, false, true),
+                ["apply"] = new PropertyDescriptor(new ClrFunction(Engine, "apply", Apply, 3, PropertyFlag.Configurable), true, false, true),
+                ["construct"] = new PropertyDescriptor(new ClrFunction(Engine, "construct", Construct, 2, PropertyFlag.Configurable), true, false, true),
+                ["defineProperty"] = new PropertyDescriptor(new ClrFunction(Engine, "defineProperty", DefineProperty, 3, PropertyFlag.Configurable), true, false, true),
+                ["deleteProperty"] = new PropertyDescriptor(new ClrFunction(Engine, "deleteProperty", DeleteProperty, 2, PropertyFlag.Configurable), true, false, true),
+                ["get"] = new PropertyDescriptor(new ClrFunction(Engine, "get", Get, 2, PropertyFlag.Configurable), true, false, true),
+                ["getOwnPropertyDescriptor"] = new PropertyDescriptor(new ClrFunction(Engine, "getOwnPropertyDescriptor", GetOwnPropertyDescriptor, 2, PropertyFlag.Configurable), true, false, true),
+                ["getPrototypeOf"] = new PropertyDescriptor(new ClrFunction(Engine, "getPrototypeOf", GetPrototypeOf, 1, PropertyFlag.Configurable), true, false, true),
+                ["has"] = new PropertyDescriptor(new ClrFunction(Engine, "has", Has, 2, PropertyFlag.Configurable), true, false, true),
+                ["isExtensible"] = new PropertyDescriptor(new ClrFunction(Engine, "isExtensible", IsExtensible, 1, PropertyFlag.Configurable), true, false, true),
+                ["ownKeys"] = new PropertyDescriptor(new ClrFunction(Engine, "ownKeys", OwnKeys, 1, PropertyFlag.Configurable), true, false, true),
+                ["preventExtensions"] = new PropertyDescriptor(new ClrFunction(Engine, "preventExtensions", PreventExtensions, 1, PropertyFlag.Configurable), true, false, true),
+                ["set"] = new PropertyDescriptor(new ClrFunction(Engine, "set", Set, 3, PropertyFlag.Configurable), true, false, true),
+                ["setPrototypeOf"] = new PropertyDescriptor(new ClrFunction(Engine, "setPrototypeOf", SetPrototypeOf, 2, PropertyFlag.Configurable), true, false, true),
             };
             SetProperties(properties);
 

+ 1 - 1
Jint/Native/RegExp/RegExpConstructor.cs

@@ -33,7 +33,7 @@ namespace Jint.Native.RegExp
         {
             var symbols = new SymbolDictionary(1)
             {
-                [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunctionInstance(_engine, "get [Symbol.species]", (thisObj, _) => thisObj, 0, PropertyFlag.Configurable), set: Undefined, PropertyFlag.Configurable)
+                [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunction(_engine, "get [Symbol.species]", (thisObj, _) => thisObj, 0, PropertyFlag.Configurable), set: Undefined, PropertyFlag.Configurable)
             };
             SetSymbols(symbols);
         }

+ 12 - 12
Jint/Native/RegExp/RegExpPrototype.cs

@@ -46,7 +46,7 @@ namespace Jint.Native.RegExp
             GetSetPropertyDescriptor CreateGetAccessorDescriptor(string name, Func<JsRegExp, JsValue> valueExtractor, JsValue? protoValue = null)
             {
                 return new GetSetPropertyDescriptor(
-                    get: new ClrFunctionInstance(Engine, name, (thisObj, arguments) =>
+                    get: new ClrFunction(Engine, name, (thisObj, arguments) =>
                     {
                         if (ReferenceEquals(thisObj, this))
                         {
@@ -69,16 +69,16 @@ namespace Jint.Native.RegExp
             var properties = new PropertyDictionary(14, checkExistingKeys: false)
             {
                 ["constructor"] = new PropertyDescriptor(_constructor, propertyFlags),
-                ["toString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toString", ToRegExpString, 0, lengthFlags), propertyFlags),
-                ["exec"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "exec", _defaultExec, 1, lengthFlags), propertyFlags),
-                ["test"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "test", Test, 1, lengthFlags), propertyFlags),
+                ["toString"] = new PropertyDescriptor(new ClrFunction(Engine, "toString", ToRegExpString, 0, lengthFlags), propertyFlags),
+                ["exec"] = new PropertyDescriptor(new ClrFunction(Engine, "exec", _defaultExec, 1, lengthFlags), propertyFlags),
+                ["test"] = new PropertyDescriptor(new ClrFunction(Engine, "test", Test, 1, lengthFlags), propertyFlags),
                 ["dotAll"] = CreateGetAccessorDescriptor("get dotAll", static r => r.DotAll),
-                ["flags"] = new GetSetPropertyDescriptor(get: new ClrFunctionInstance(Engine, "get flags", Flags, 0, lengthFlags), set: Undefined, flags: PropertyFlag.Configurable),
+                ["flags"] = new GetSetPropertyDescriptor(get: new ClrFunction(Engine, "get flags", Flags, 0, lengthFlags), set: Undefined, flags: PropertyFlag.Configurable),
                 ["global"] = CreateGetAccessorDescriptor("get global", static r => r.Global),
                 ["hasIndices"] = CreateGetAccessorDescriptor("get hasIndices", static r => r.Indices),
                 ["ignoreCase"] = CreateGetAccessorDescriptor("get ignoreCase", static r => r.IgnoreCase),
                 ["multiline"] = CreateGetAccessorDescriptor("get multiline", static r => r.Multiline),
-                ["source"] = new GetSetPropertyDescriptor(get: new ClrFunctionInstance(Engine, "get source", Source, 0, lengthFlags), set: Undefined, flags: PropertyFlag.Configurable),
+                ["source"] = new GetSetPropertyDescriptor(get: new ClrFunction(Engine, "get source", Source, 0, lengthFlags), set: Undefined, flags: PropertyFlag.Configurable),
                 ["sticky"] = CreateGetAccessorDescriptor("get sticky", static r => r.Sticky),
                 ["unicode"] = CreateGetAccessorDescriptor("get unicode", static r => r.FullUnicode),
                 ["unicodeSets"] = CreateGetAccessorDescriptor("get unicodeSets", static r => r.UnicodeSets)
@@ -87,11 +87,11 @@ namespace Jint.Native.RegExp
 
             var symbols = new SymbolDictionary(5)
             {
-                [GlobalSymbolRegistry.Match] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "[Symbol.match]", Match, 1, lengthFlags), propertyFlags),
-                [GlobalSymbolRegistry.MatchAll] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "[Symbol.matchAll]", MatchAll, 1, lengthFlags), propertyFlags),
-                [GlobalSymbolRegistry.Replace] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "[Symbol.replace]", Replace, 2, lengthFlags), propertyFlags),
-                [GlobalSymbolRegistry.Search] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "[Symbol.search]", Search, 1, lengthFlags), propertyFlags),
-                [GlobalSymbolRegistry.Split] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "[Symbol.split]", Split, 2, lengthFlags), propertyFlags)
+                [GlobalSymbolRegistry.Match] = new PropertyDescriptor(new ClrFunction(Engine, "[Symbol.match]", Match, 1, lengthFlags), propertyFlags),
+                [GlobalSymbolRegistry.MatchAll] = new PropertyDescriptor(new ClrFunction(Engine, "[Symbol.matchAll]", MatchAll, 1, lengthFlags), propertyFlags),
+                [GlobalSymbolRegistry.Replace] = new PropertyDescriptor(new ClrFunction(Engine, "[Symbol.replace]", Replace, 2, lengthFlags), propertyFlags),
+                [GlobalSymbolRegistry.Search] = new PropertyDescriptor(new ClrFunction(Engine, "[Symbol.search]", Search, 1, lengthFlags), propertyFlags),
+                [GlobalSymbolRegistry.Split] = new PropertyDescriptor(new ClrFunction(Engine, "[Symbol.split]", Split, 2, lengthFlags), propertyFlags)
             };
             SetSymbols(symbols);
         }
@@ -837,7 +837,7 @@ namespace Jint.Native.RegExp
             return RegExpBuiltinExec(ri, s);
         }
 
-        internal bool HasDefaultExec => Get(PropertyExec) is ClrFunctionInstance functionInstance && functionInstance._func == _defaultExec;
+        internal bool HasDefaultExec => Get(PropertyExec) is ClrFunction functionInstance && functionInstance._func == _defaultExec;
 
         /// <summary>
         /// https://tc39.es/ecma262/#sec-regexpbuiltinexec

+ 1 - 1
Jint/Native/RegExp/RegExpStringIteratorPrototype.cs

@@ -24,7 +24,7 @@ internal sealed class RegExpStringIteratorPrototype : IteratorPrototype
     {
         var properties = new PropertyDictionary(1, checkExistingKeys: false)
         {
-            [KnownKeys.Next] = new(new ClrFunctionInstance(Engine, "next", Next, 0, PropertyFlag.Configurable), true, false, true)
+            [KnownKeys.Next] = new(new ClrFunction(Engine, "next", Next, 0, PropertyFlag.Configurable), true, false, true)
         };
         SetProperties(properties);
 

+ 1 - 1
Jint/Native/Set/SetConstructor.cs

@@ -31,7 +31,7 @@ internal sealed class SetConstructor : Constructor
     {
         var symbols = new SymbolDictionary(1)
         {
-            [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunctionInstance(_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);

+ 1 - 1
Jint/Native/Set/SetIteratorPrototype.cs

@@ -24,7 +24,7 @@ internal sealed class SetIteratorPrototype : IteratorPrototype
     {
         var properties = new PropertyDictionary(1, checkExistingKeys: false)
         {
-            [KnownKeys.Next] = new(new ClrFunctionInstance(Engine, "next", Next, 0, PropertyFlag.Configurable), true, false, true)
+            [KnownKeys.Next] = new(new ClrFunction(Engine, "next", Next, 0, PropertyFlag.Configurable), true, false, true)
         };
         SetProperties(properties);
 

+ 11 - 11
Jint/Native/Set/SetPrototype.cs

@@ -32,22 +32,22 @@ internal sealed class SetPrototype : Prototype
         {
             ["length"] = new PropertyDescriptor(0, PropertyFlag.Configurable),
             ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
-            ["add"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "add", Add, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
-            ["clear"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "clear", Clear, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
-            ["delete"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "delete", Delete, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
-            ["entries"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "entries", Entries, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
-            ["forEach"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "forEach", ForEach, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
-            ["has"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "has", Has, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
-            ["keys"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "keys", Values, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
-            ["values"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "values", Values, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
-            ["size"] = new GetSetPropertyDescriptor(get: new ClrFunctionInstance(Engine, "get size", Size, 0, PropertyFlag.Configurable), set: null, PropertyFlag.Configurable),
-            ["union"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "union", Union, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable)
+            ["add"] = new PropertyDescriptor(new ClrFunction(Engine, "add", Add, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
+            ["clear"] = new PropertyDescriptor(new ClrFunction(Engine, "clear", Clear, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
+            ["delete"] = new PropertyDescriptor(new ClrFunction(Engine, "delete", Delete, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
+            ["entries"] = new PropertyDescriptor(new ClrFunction(Engine, "entries", Entries, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
+            ["forEach"] = new PropertyDescriptor(new ClrFunction(Engine, "forEach", ForEach, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
+            ["has"] = new PropertyDescriptor(new ClrFunction(Engine, "has", Has, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
+            ["keys"] = new PropertyDescriptor(new ClrFunction(Engine, "keys", Values, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
+            ["values"] = new PropertyDescriptor(new ClrFunction(Engine, "values", Values, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable),
+            ["size"] = new GetSetPropertyDescriptor(get: new ClrFunction(Engine, "get size", Size, 0, PropertyFlag.Configurable), set: null, PropertyFlag.Configurable),
+            ["union"] = new PropertyDescriptor(new ClrFunction(Engine, "union", Union, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable)
         };
         SetProperties(properties);
 
         var symbols = new SymbolDictionary(2)
         {
-            [GlobalSymbolRegistry.Iterator] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "iterator", Values, 1, PropertyFlag.Configurable), true, false, true),
+            [GlobalSymbolRegistry.Iterator] = new PropertyDescriptor(new ClrFunction(Engine, "iterator", Values, 1, PropertyFlag.Configurable), true, false, true),
             [GlobalSymbolRegistry.ToStringTag] = new PropertyDescriptor("Set", false, false, true)
         };
         SetSymbols(symbols);

+ 2 - 2
Jint/Native/ShadowRealm/ShadowRealmPrototype.cs

@@ -31,8 +31,8 @@ internal sealed class ShadowRealmPrototype : Prototype
         {
             ["length"] = new PropertyDescriptor(0, PropertyFlag.Configurable),
             ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
-            ["evaluate"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "evaluate", Evaluate, 1, PropertyFlag.Configurable), propertyFlags),
-            ["importValue"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "importValue", ImportValue, 2, PropertyFlag.Configurable), propertyFlags),
+            ["evaluate"] = new PropertyDescriptor(new ClrFunction(Engine, "evaluate", Evaluate, 1, PropertyFlag.Configurable), propertyFlags),
+            ["importValue"] = new PropertyDescriptor(new ClrFunction(Engine, "importValue", ImportValue, 2, PropertyFlag.Configurable), propertyFlags),
         };
         SetProperties(properties);
 

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

@@ -37,13 +37,13 @@ internal sealed class SharedArrayBufferConstructor : Constructor
         const PropertyFlag lengthFlags = PropertyFlag.Configurable;
         var properties = new PropertyDictionary(1, checkExistingKeys: false)
         {
-            ["isView"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunctionInstance(Engine, "isView", IsView, 1, lengthFlags), PropertyFlag.Configurable | PropertyFlag.Writable)),
+            ["isView"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunction(Engine, "isView", IsView, 1, lengthFlags), PropertyFlag.Configurable | PropertyFlag.Writable)),
         };
         SetProperties(properties);
 
         var symbols = new SymbolDictionary(1)
         {
-            [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(get: new ClrFunctionInstance(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);
     }

+ 5 - 5
Jint/Native/SharedArrayBuffer/SharedArrayBufferPrototype.cs

@@ -28,12 +28,12 @@ internal sealed class SharedArrayBufferPrototype : Prototype
         const PropertyFlag lengthFlags = PropertyFlag.Configurable;
         var properties = new PropertyDictionary(3, checkExistingKeys: false)
         {
-            ["byteLength"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get byteLength", ByteLength, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
+            ["byteLength"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get byteLength", ByteLength, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
             [KnownKeys.Constructor] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
-            ["growable"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get growable", Growable, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
-            ["grow"] = new PropertyDescriptor(new ClrFunctionInstance(_engine, "grow", Grow, 1, lengthFlags), PropertyFlag.NonEnumerable),
-            ["maxByteLength"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get maxByteLength", MaxByteLength, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
-            ["slice"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "slice", Slice, 2, lengthFlags), PropertyFlag.Configurable | PropertyFlag.Writable)
+            ["growable"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get growable", Growable, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
+            ["grow"] = new PropertyDescriptor(new ClrFunction(_engine, "grow", Grow, 1, lengthFlags), PropertyFlag.NonEnumerable),
+            ["maxByteLength"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get maxByteLength", MaxByteLength, 0, lengthFlags), Undefined, PropertyFlag.Configurable),
+            ["slice"] = new PropertyDescriptor(new ClrFunction(Engine, "slice", Slice, 2, lengthFlags), PropertyFlag.Configurable | PropertyFlag.Writable)
         };
         SetProperties(properties);
 

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

@@ -38,9 +38,9 @@ namespace Jint.Native.String
         {
             var properties = new PropertyDictionary(3, checkExistingKeys: false)
             {
-                ["fromCharCode"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunctionInstance(Engine, "fromCharCode", FromCharCode, 1), PropertyFlag.NonEnumerable)),
-                ["fromCodePoint"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunctionInstance(Engine, "fromCodePoint", FromCodePoint, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable)),
-                ["raw"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunctionInstance(Engine, "raw", Raw, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable))
+                ["fromCharCode"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunction(Engine, "fromCharCode", FromCharCode, 1), PropertyFlag.NonEnumerable)),
+                ["fromCodePoint"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunction(Engine, "fromCodePoint", FromCodePoint, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable)),
+                ["raw"] = new PropertyDescriptor(new PropertyDescriptor(new ClrFunction(Engine, "raw", Raw, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable))
             };
             SetProperties(properties);
         }

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

@@ -4,7 +4,7 @@ using Jint.Runtime.Descriptors;
 
 namespace Jint.Native.String;
 
-internal class StringInstance : ObjectInstance, IPrimitiveInstance
+internal class StringInstance : ObjectInstance, IJsPrimitive
 {
     internal PropertyDescriptor? _length;
 
@@ -15,9 +15,9 @@ internal class StringInstance : ObjectInstance, IPrimitiveInstance
         _length = PropertyDescriptor.AllForbiddenDescriptor.ForNumber(value.Length);
     }
 
-    Types IPrimitiveInstance.Type => Types.String;
+    Types IJsPrimitive.Type => Types.String;
 
-    JsValue IPrimitiveInstance.PrimitiveValue => StringData;
+    JsValue IJsPrimitive.PrimitiveValue => StringData;
 
     public JsString StringData { get; }
 

+ 1 - 1
Jint/Native/String/StringIteratorPrototype.cs

@@ -24,7 +24,7 @@ internal sealed class StringIteratorPrototype : IteratorPrototype
     {
         var properties = new PropertyDictionary(1, checkExistingKeys: false)
         {
-            [KnownKeys.Next] = new(new ClrFunctionInstance(Engine, "next", Next, 0, PropertyFlag.Configurable), true, false, true)
+            [KnownKeys.Next] = new(new ClrFunction(Engine, "next", Next, 0, PropertyFlag.Configurable), true, false, true)
         };
         SetProperties(properties);
 

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

@@ -41,54 +41,54 @@ namespace Jint.Native.String
             const PropertyFlag lengthFlags = PropertyFlag.Configurable;
             const PropertyFlag propertyFlags = lengthFlags | PropertyFlag.Writable;
 
-            var trimStart = new PropertyDescriptor(new ClrFunctionInstance(Engine, "trimStart", TrimStart, 0, lengthFlags), propertyFlags);
-            var trimEnd = new PropertyDescriptor(new ClrFunctionInstance(Engine, "trimEnd", TrimEnd, 0, lengthFlags), propertyFlags);
+            var trimStart = new PropertyDescriptor(new ClrFunction(Engine, "trimStart", TrimStart, 0, lengthFlags), propertyFlags);
+            var trimEnd = new PropertyDescriptor(new ClrFunction(Engine, "trimEnd", TrimEnd, 0, lengthFlags), propertyFlags);
             var properties = new PropertyDictionary(37, checkExistingKeys: false)
             {
                 ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
-                ["toString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toString", ToStringString, 0, lengthFlags), propertyFlags),
-                ["valueOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "valueOf", ValueOf, 0, lengthFlags), propertyFlags),
-                ["charAt"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "charAt", CharAt, 1, lengthFlags), propertyFlags),
-                ["charCodeAt"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "charCodeAt", CharCodeAt, 1, lengthFlags), propertyFlags),
-                ["codePointAt"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "codePointAt", CodePointAt, 1, lengthFlags), propertyFlags),
-                ["concat"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "concat", Concat, 1, lengthFlags), propertyFlags),
-                ["indexOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "indexOf", IndexOf, 1, lengthFlags), propertyFlags),
-                ["endsWith"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "endsWith", EndsWith, 1, lengthFlags), propertyFlags),
-                ["startsWith"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "startsWith", StartsWith, 1, lengthFlags), propertyFlags),
-                ["lastIndexOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "lastIndexOf", LastIndexOf, 1, lengthFlags), propertyFlags),
-                ["localeCompare"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "localeCompare", LocaleCompare, 1, lengthFlags), propertyFlags),
-                ["match"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "match", Match, 1, lengthFlags), propertyFlags),
-                ["matchAll"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "matchAll", MatchAll, 1, lengthFlags), propertyFlags),
-                ["replace"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "replace", Replace, 2, lengthFlags), propertyFlags),
-                ["replaceAll"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "replaceAll", ReplaceAll, 2, lengthFlags), propertyFlags),
-                ["search"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "search", Search, 1, lengthFlags), propertyFlags),
-                ["slice"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "slice", Slice, 2, lengthFlags), propertyFlags),
-                ["split"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "split", Split, 2, lengthFlags), propertyFlags),
-                ["substr"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "substr", Substr, 2), propertyFlags),
-                ["substring"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "substring", Substring, 2, lengthFlags), propertyFlags),
-                ["toLowerCase"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toLowerCase", ToLowerCase, 0, lengthFlags), propertyFlags),
-                ["toLocaleLowerCase"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toLocaleLowerCase", ToLocaleLowerCase, 0, lengthFlags), propertyFlags),
-                ["toUpperCase"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toUpperCase", ToUpperCase, 0, lengthFlags), propertyFlags),
-                ["toLocaleUpperCase"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toLocaleUpperCase", ToLocaleUpperCase, 0, lengthFlags), propertyFlags),
-                ["trim"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "trim", Trim, 0, lengthFlags), propertyFlags),
+                ["toString"] = new PropertyDescriptor(new ClrFunction(Engine, "toString", ToStringString, 0, lengthFlags), propertyFlags),
+                ["valueOf"] = new PropertyDescriptor(new ClrFunction(Engine, "valueOf", ValueOf, 0, lengthFlags), propertyFlags),
+                ["charAt"] = new PropertyDescriptor(new ClrFunction(Engine, "charAt", CharAt, 1, lengthFlags), propertyFlags),
+                ["charCodeAt"] = new PropertyDescriptor(new ClrFunction(Engine, "charCodeAt", CharCodeAt, 1, lengthFlags), propertyFlags),
+                ["codePointAt"] = new PropertyDescriptor(new ClrFunction(Engine, "codePointAt", CodePointAt, 1, lengthFlags), propertyFlags),
+                ["concat"] = new PropertyDescriptor(new ClrFunction(Engine, "concat", Concat, 1, lengthFlags), propertyFlags),
+                ["indexOf"] = new PropertyDescriptor(new ClrFunction(Engine, "indexOf", IndexOf, 1, lengthFlags), propertyFlags),
+                ["endsWith"] = new PropertyDescriptor(new ClrFunction(Engine, "endsWith", EndsWith, 1, lengthFlags), propertyFlags),
+                ["startsWith"] = new PropertyDescriptor(new ClrFunction(Engine, "startsWith", StartsWith, 1, lengthFlags), propertyFlags),
+                ["lastIndexOf"] = new PropertyDescriptor(new ClrFunction(Engine, "lastIndexOf", LastIndexOf, 1, lengthFlags), propertyFlags),
+                ["localeCompare"] = new PropertyDescriptor(new ClrFunction(Engine, "localeCompare", LocaleCompare, 1, lengthFlags), propertyFlags),
+                ["match"] = new PropertyDescriptor(new ClrFunction(Engine, "match", Match, 1, lengthFlags), propertyFlags),
+                ["matchAll"] = new PropertyDescriptor(new ClrFunction(Engine, "matchAll", MatchAll, 1, lengthFlags), propertyFlags),
+                ["replace"] = new PropertyDescriptor(new ClrFunction(Engine, "replace", Replace, 2, lengthFlags), propertyFlags),
+                ["replaceAll"] = new PropertyDescriptor(new ClrFunction(Engine, "replaceAll", ReplaceAll, 2, lengthFlags), propertyFlags),
+                ["search"] = new PropertyDescriptor(new ClrFunction(Engine, "search", Search, 1, lengthFlags), propertyFlags),
+                ["slice"] = new PropertyDescriptor(new ClrFunction(Engine, "slice", Slice, 2, lengthFlags), propertyFlags),
+                ["split"] = new PropertyDescriptor(new ClrFunction(Engine, "split", Split, 2, lengthFlags), propertyFlags),
+                ["substr"] = new PropertyDescriptor(new ClrFunction(Engine, "substr", Substr, 2), propertyFlags),
+                ["substring"] = new PropertyDescriptor(new ClrFunction(Engine, "substring", Substring, 2, lengthFlags), propertyFlags),
+                ["toLowerCase"] = new PropertyDescriptor(new ClrFunction(Engine, "toLowerCase", ToLowerCase, 0, lengthFlags), propertyFlags),
+                ["toLocaleLowerCase"] = new PropertyDescriptor(new ClrFunction(Engine, "toLocaleLowerCase", ToLocaleLowerCase, 0, lengthFlags), propertyFlags),
+                ["toUpperCase"] = new PropertyDescriptor(new ClrFunction(Engine, "toUpperCase", ToUpperCase, 0, lengthFlags), propertyFlags),
+                ["toLocaleUpperCase"] = new PropertyDescriptor(new ClrFunction(Engine, "toLocaleUpperCase", ToLocaleUpperCase, 0, lengthFlags), propertyFlags),
+                ["trim"] = new PropertyDescriptor(new ClrFunction(Engine, "trim", Trim, 0, lengthFlags), propertyFlags),
                 ["trimStart"] = trimStart,
                 ["trimEnd"] = trimEnd,
                 ["trimLeft"] = trimStart,
                 ["trimRight"] = trimEnd,
-                ["padStart"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "padStart", PadStart, 1, lengthFlags), propertyFlags),
-                ["padEnd"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "padEnd", PadEnd, 1, lengthFlags), propertyFlags),
-                ["includes"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "includes", Includes, 1, lengthFlags), propertyFlags),
-                ["normalize"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "normalize", Normalize, 0, lengthFlags), propertyFlags),
-                ["repeat"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "repeat", Repeat, 1, lengthFlags), propertyFlags),
-                ["at"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "at", At, 1, lengthFlags), propertyFlags),
-                ["isWellFormed"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "isWellFormed", IsWellFormed, 0, lengthFlags), propertyFlags),
-                ["toWellFormed"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toWellFormed", ToWellFormed, 0, lengthFlags), propertyFlags),
+                ["padStart"] = new PropertyDescriptor(new ClrFunction(Engine, "padStart", PadStart, 1, lengthFlags), propertyFlags),
+                ["padEnd"] = new PropertyDescriptor(new ClrFunction(Engine, "padEnd", PadEnd, 1, lengthFlags), propertyFlags),
+                ["includes"] = new PropertyDescriptor(new ClrFunction(Engine, "includes", Includes, 1, lengthFlags), propertyFlags),
+                ["normalize"] = new PropertyDescriptor(new ClrFunction(Engine, "normalize", Normalize, 0, lengthFlags), propertyFlags),
+                ["repeat"] = new PropertyDescriptor(new ClrFunction(Engine, "repeat", Repeat, 1, lengthFlags), propertyFlags),
+                ["at"] = new PropertyDescriptor(new ClrFunction(Engine, "at", At, 1, lengthFlags), propertyFlags),
+                ["isWellFormed"] = new PropertyDescriptor(new ClrFunction(Engine, "isWellFormed", IsWellFormed, 0, lengthFlags), propertyFlags),
+                ["toWellFormed"] = new PropertyDescriptor(new ClrFunction(Engine, "toWellFormed", ToWellFormed, 0, lengthFlags), propertyFlags),
             };
             SetProperties(properties);
 
             var symbols = new SymbolDictionary(1)
             {
-                [GlobalSymbolRegistry.Iterator] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "[Symbol.iterator]", Iterator, 0, lengthFlags), propertyFlags)
+                [GlobalSymbolRegistry.Iterator] = new PropertyDescriptor(new ClrFunction(Engine, "[Symbol.iterator]", Iterator, 0, lengthFlags), propertyFlags)
             };
             SetSymbols(symbols);
         }

+ 2 - 2
Jint/Native/Symbol/SymbolConstructor.cs

@@ -39,8 +39,8 @@ namespace Jint.Native.Symbol
 
             var properties = new PropertyDictionary(15, checkExistingKeys: false)
             {
-                ["for"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "for", For, 1, lengthFlags), PropertyFlag.Writable | PropertyFlag.Configurable),
-                ["keyFor"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "keyFor", KeyFor, 1, lengthFlags), PropertyFlag.Writable | PropertyFlag.Configurable),
+                ["for"] = new PropertyDescriptor(new ClrFunction(Engine, "for", For, 1, lengthFlags), PropertyFlag.Writable | PropertyFlag.Configurable),
+                ["keyFor"] = new PropertyDescriptor(new ClrFunction(Engine, "keyFor", KeyFor, 1, lengthFlags), PropertyFlag.Writable | PropertyFlag.Configurable),
                 ["hasInstance"] = new PropertyDescriptor(GlobalSymbolRegistry.HasInstance, propertyFlags),
                 ["isConcatSpreadable"] = new PropertyDescriptor(GlobalSymbolRegistry.IsConcatSpreadable, propertyFlags),
                 ["iterator"] = new PropertyDescriptor(GlobalSymbolRegistry.Iterator, propertyFlags),

+ 3 - 3
Jint/Native/Symbol/SymbolInstance.cs

@@ -3,7 +3,7 @@ using Jint.Runtime;
 
 namespace Jint.Native.Symbol;
 
-internal sealed class SymbolInstance : ObjectInstance, IPrimitiveInstance
+internal sealed class SymbolInstance : ObjectInstance, IJsPrimitive
 {
     internal SymbolInstance(
         Engine engine,
@@ -14,9 +14,9 @@ internal sealed class SymbolInstance : ObjectInstance, IPrimitiveInstance
         SymbolData = symbol;
     }
 
-    Types IPrimitiveInstance.Type => Types.Symbol;
+    Types IJsPrimitive.Type => Types.Symbol;
 
-    JsValue IPrimitiveInstance.PrimitiveValue => SymbolData;
+    JsValue IJsPrimitive.PrimitiveValue => SymbolData;
 
     public JsSymbol SymbolData { get; }
 }

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

@@ -34,14 +34,14 @@ namespace Jint.Native.Symbol
             {
                 ["length"] = new PropertyDescriptor(JsNumber.PositiveZero, propertyFlags),
                 ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.Configurable | PropertyFlag.Writable),
-                ["description"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(Engine, "description", Description, 0, lengthFlags), Undefined, propertyFlags),
-                ["toString"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toString", ToSymbolString, 0, lengthFlags), PropertyFlag.Configurable | PropertyFlag.Writable),
-                ["valueOf"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "valueOf", ValueOf, 0, lengthFlags), PropertyFlag.Configurable | PropertyFlag.Writable)
+                ["description"] = new GetSetPropertyDescriptor(new ClrFunction(Engine, "description", Description, 0, lengthFlags), Undefined, propertyFlags),
+                ["toString"] = new PropertyDescriptor(new ClrFunction(Engine, "toString", ToSymbolString, 0, lengthFlags), PropertyFlag.Configurable | PropertyFlag.Writable),
+                ["valueOf"] = new PropertyDescriptor(new ClrFunction(Engine, "valueOf", ValueOf, 0, lengthFlags), PropertyFlag.Configurable | PropertyFlag.Writable)
             });
 
             SetSymbols(new SymbolDictionary(1)
                 {
-                    [GlobalSymbolRegistry.ToPrimitive] = new PropertyDescriptor(new ClrFunctionInstance(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)
                 }
             );
         }

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

@@ -33,14 +33,14 @@ namespace Jint.Native.TypedArray
         {
             var properties = new PropertyDictionary(2, false)
             {
-                ["from"] = new(new PropertyDescriptor(new ClrFunctionInstance(Engine, "from", From, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable)),
-                ["of"] = new(new PropertyDescriptor(new ClrFunctionInstance(Engine, "of", Of, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable))
+                ["from"] = new(new PropertyDescriptor(new ClrFunction(Engine, "from", From, 1, PropertyFlag.Configurable), PropertyFlag.NonEnumerable)),
+                ["of"] = new(new PropertyDescriptor(new ClrFunction(Engine, "of", Of, 0, PropertyFlag.Configurable), PropertyFlag.NonEnumerable))
             };
             SetProperties(properties);
 
             var symbols = new SymbolDictionary(1)
             {
-                [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(new ClrFunctionInstance(Engine, "get [Symbol.species]", Species, 0, PropertyFlag.Configurable), Undefined, PropertyFlag.Configurable)
+                [GlobalSymbolRegistry.Species] = new GetSetPropertyDescriptor(new ClrFunction(Engine, "get [Symbol.species]", Species, 0, PropertyFlag.Configurable), Undefined, PropertyFlag.Configurable)
             };
             SetSymbols(symbols);
         }

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

@@ -21,7 +21,7 @@ namespace Jint.Native.TypedArray
     internal sealed class IntrinsicTypedArrayPrototype : Prototype
     {
         private readonly IntrinsicTypedArrayConstructor _constructor;
-        private ClrFunctionInstance? _originalIteratorFunction;
+        private ClrFunction? _originalIteratorFunction;
 
         internal IntrinsicTypedArrayPrototype(
             Engine engine,
@@ -38,50 +38,50 @@ namespace Jint.Native.TypedArray
             const PropertyFlag PropertyFlags = PropertyFlag.Writable | PropertyFlag.Configurable;
             var properties = new PropertyDictionary(36, false)
             {
-                ["at"] = new(new ClrFunctionInstance(Engine, "at", At, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["buffer"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get buffer", Buffer, 0, LengthFlags), Undefined, PropertyFlag.Configurable),
-                ["byteLength"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(_engine, "get byteLength", ByteLength, 0, LengthFlags), Undefined, PropertyFlag.Configurable),
-                ["byteOffset"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(Engine, "get byteOffset", ByteOffset, 0, LengthFlags), Undefined, PropertyFlag.Configurable),
+                ["at"] = new(new ClrFunction(Engine, "at", At, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["buffer"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get buffer", Buffer, 0, LengthFlags), Undefined, PropertyFlag.Configurable),
+                ["byteLength"] = new GetSetPropertyDescriptor(new ClrFunction(_engine, "get byteLength", ByteLength, 0, LengthFlags), Undefined, PropertyFlag.Configurable),
+                ["byteOffset"] = new GetSetPropertyDescriptor(new ClrFunction(Engine, "get byteOffset", ByteOffset, 0, LengthFlags), Undefined, PropertyFlag.Configurable),
                 ["constructor"] = new(_constructor, PropertyFlag.NonEnumerable),
-                ["copyWithin"] = new(new ClrFunctionInstance(Engine, "copyWithin", CopyWithin, 2, PropertyFlag.Configurable), PropertyFlags),
-                ["entries"] = new(new ClrFunctionInstance(Engine, "entries", Entries, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["every"] = new(new ClrFunctionInstance(Engine, "every", Every, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["fill"] = new(new ClrFunctionInstance(Engine, "fill", Fill, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["filter"] = new(new ClrFunctionInstance(Engine, "filter", Filter, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["find"] = new(new ClrFunctionInstance(Engine, "find", Find, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["findIndex"] = new(new ClrFunctionInstance(Engine, "findIndex", FindIndex, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["findLast"] = new(new ClrFunctionInstance(Engine, "findLast", FindLast, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["findLastIndex"] = new(new ClrFunctionInstance(Engine, "findLastIndex", FindLastIndex, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["forEach"] = new(new ClrFunctionInstance(Engine, "forEach", ForEach, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["includes"] = new(new ClrFunctionInstance(Engine, "includes", Includes, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["indexOf"] = new(new ClrFunctionInstance(Engine, "indexOf", IndexOf, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["join"] = new(new ClrFunctionInstance(Engine, "join", Join, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["keys"] = new(new ClrFunctionInstance(Engine, "keys", Keys, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["lastIndexOf"] = new(new ClrFunctionInstance(Engine, "lastIndexOf", LastIndexOf, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["length"] = new GetSetPropertyDescriptor(new ClrFunctionInstance(Engine, "get length", GetLength, 0, LengthFlags), Undefined, PropertyFlag.Configurable),
-                ["map"] = new(new ClrFunctionInstance(Engine, "map", Map, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["reduce"] = new(new ClrFunctionInstance(Engine, "reduce", Reduce, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["reduceRight"] = new(new ClrFunctionInstance(Engine, "reduceRight", ReduceRight, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["reverse"] = new(new ClrFunctionInstance(Engine, "reverse", Reverse, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["set"] = new(new ClrFunctionInstance(Engine, "set", Set, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["slice"] = new(new ClrFunctionInstance(Engine, "slice", Slice, 2, PropertyFlag.Configurable), PropertyFlags),
-                ["some"] = new(new ClrFunctionInstance(Engine, "some", Some, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["sort"] = new(new ClrFunctionInstance(Engine, "sort", Sort, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["subarray"] = new(new ClrFunctionInstance(Engine, "subarray", Subarray, 2, PropertyFlag.Configurable), PropertyFlags),
-                ["toLocaleString"] = new(new ClrFunctionInstance(Engine, "toLocaleString", ToLocaleString, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["toReversed"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toReversed", ToReversed, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["toSorted"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "toSorted", ToSorted, 1, PropertyFlag.Configurable), PropertyFlags),
-                ["toString"] = new(new ClrFunctionInstance(Engine, "toLocaleString", _realm.Intrinsics.Array.PrototypeObject.ToString, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["values"] = new(new ClrFunctionInstance(Engine, "values", Values, 0, PropertyFlag.Configurable), PropertyFlags),
-                ["with"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "with", With, 2, PropertyFlag.Configurable), PropertyFlags),
+                ["copyWithin"] = new(new ClrFunction(Engine, "copyWithin", CopyWithin, 2, PropertyFlag.Configurable), PropertyFlags),
+                ["entries"] = new(new ClrFunction(Engine, "entries", Entries, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["every"] = new(new ClrFunction(Engine, "every", Every, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["fill"] = new(new ClrFunction(Engine, "fill", Fill, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["filter"] = new(new ClrFunction(Engine, "filter", Filter, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["find"] = new(new ClrFunction(Engine, "find", Find, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["findIndex"] = new(new ClrFunction(Engine, "findIndex", FindIndex, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["findLast"] = new(new ClrFunction(Engine, "findLast", FindLast, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["findLastIndex"] = new(new ClrFunction(Engine, "findLastIndex", FindLastIndex, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["forEach"] = new(new ClrFunction(Engine, "forEach", ForEach, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["includes"] = new(new ClrFunction(Engine, "includes", Includes, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["indexOf"] = new(new ClrFunction(Engine, "indexOf", IndexOf, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["join"] = new(new ClrFunction(Engine, "join", Join, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["keys"] = new(new ClrFunction(Engine, "keys", Keys, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["lastIndexOf"] = new(new ClrFunction(Engine, "lastIndexOf", LastIndexOf, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["length"] = new GetSetPropertyDescriptor(new ClrFunction(Engine, "get length", GetLength, 0, LengthFlags), Undefined, PropertyFlag.Configurable),
+                ["map"] = new(new ClrFunction(Engine, "map", Map, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["reduce"] = new(new ClrFunction(Engine, "reduce", Reduce, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["reduceRight"] = new(new ClrFunction(Engine, "reduceRight", ReduceRight, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["reverse"] = new(new ClrFunction(Engine, "reverse", Reverse, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["set"] = new(new ClrFunction(Engine, "set", Set, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["slice"] = new(new ClrFunction(Engine, "slice", Slice, 2, PropertyFlag.Configurable), PropertyFlags),
+                ["some"] = new(new ClrFunction(Engine, "some", Some, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["sort"] = new(new ClrFunction(Engine, "sort", Sort, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["subarray"] = new(new ClrFunction(Engine, "subarray", Subarray, 2, PropertyFlag.Configurable), PropertyFlags),
+                ["toLocaleString"] = new(new ClrFunction(Engine, "toLocaleString", ToLocaleString, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["toReversed"] = new PropertyDescriptor(new ClrFunction(Engine, "toReversed", ToReversed, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["toSorted"] = new PropertyDescriptor(new ClrFunction(Engine, "toSorted", ToSorted, 1, PropertyFlag.Configurable), PropertyFlags),
+                ["toString"] = new(new ClrFunction(Engine, "toLocaleString", _realm.Intrinsics.Array.PrototypeObject.ToString, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["values"] = new(new ClrFunction(Engine, "values", Values, 0, PropertyFlag.Configurable), PropertyFlags),
+                ["with"] = new PropertyDescriptor(new ClrFunction(Engine, "with", With, 2, PropertyFlag.Configurable), PropertyFlags),
             };
             SetProperties(properties);
 
-            _originalIteratorFunction = new ClrFunctionInstance(Engine, "iterator", Values, 1);
+            _originalIteratorFunction = new ClrFunction(Engine, "iterator", Values, 1);
             var symbols = new SymbolDictionary(2)
             {
                 [GlobalSymbolRegistry.Iterator] = new(_originalIteratorFunction, PropertyFlags),
-                [GlobalSymbolRegistry.ToStringTag] = new GetSetPropertyDescriptor(new ClrFunctionInstance(Engine, "get [Symbol.toStringTag]", ToStringTag, 0, PropertyFlag.Configurable), Undefined, PropertyFlag.Configurable)
+                [GlobalSymbolRegistry.ToStringTag] = new GetSetPropertyDescriptor(new ClrFunction(Engine, "get [Symbol.toStringTag]", ToStringTag, 0, PropertyFlag.Configurable), Undefined, PropertyFlag.Configurable)
             };
             SetSymbols(symbols);
         }

+ 4 - 4
Jint/Native/WeakMap/WeakMapPrototype.cs

@@ -33,10 +33,10 @@ internal sealed class WeakMapPrototype : Prototype
         {
             ["length"] = new PropertyDescriptor(0, PropertyFlag.Configurable),
             ["constructor"] = new PropertyDescriptor(_constructor, PropertyFlag.NonEnumerable),
-            ["delete"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "delete", Delete, 1, PropertyFlag.Configurable), propertyFlags),
-            ["get"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "get", Get, 1, PropertyFlag.Configurable), propertyFlags),
-            ["has"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "has", Has, 1, PropertyFlag.Configurable), propertyFlags),
-            ["set"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "set", Set, 2, PropertyFlag.Configurable), propertyFlags),
+            ["delete"] = new PropertyDescriptor(new ClrFunction(Engine, "delete", Delete, 1, PropertyFlag.Configurable), propertyFlags),
+            ["get"] = new PropertyDescriptor(new ClrFunction(Engine, "get", Get, 1, PropertyFlag.Configurable), propertyFlags),
+            ["has"] = new PropertyDescriptor(new ClrFunction(Engine, "has", Has, 1, PropertyFlag.Configurable), propertyFlags),
+            ["set"] = new PropertyDescriptor(new ClrFunction(Engine, "set", Set, 2, PropertyFlag.Configurable), propertyFlags),
         };
         SetProperties(properties);
 

+ 1 - 1
Jint/Native/WeakRef/WeakRefPrototype.cs

@@ -30,7 +30,7 @@ internal sealed class WeakRefPrototype : Prototype
         var properties = new PropertyDictionary(5, checkExistingKeys: false)
         {
             ["constructor"] = new(_constructor, PropertyFlag.NonEnumerable),
-            ["deref"] = new(new ClrFunctionInstance(Engine, "deref", Deref, 0, PropertyFlag.Configurable), propertyFlags)
+            ["deref"] = new(new ClrFunction(Engine, "deref", Deref, 0, PropertyFlag.Configurable), propertyFlags)
         };
         SetProperties(properties);
 

+ 4 - 4
Jint/Native/WeakSet/WeakSetPrototype.cs

@@ -15,7 +15,7 @@ namespace Jint.Native.WeakSet;
 internal sealed class WeakSetPrototype : Prototype
 {
     private readonly WeakSetConstructor _constructor;
-    internal ClrFunctionInstance _originalAddFunction = null!;
+    internal ClrFunction _originalAddFunction = null!;
 
     internal WeakSetPrototype(
         Engine engine,
@@ -29,16 +29,16 @@ internal sealed class WeakSetPrototype : Prototype
 
     protected override void Initialize()
     {
-        _originalAddFunction = new ClrFunctionInstance(Engine, "add", Add, 1, PropertyFlag.Configurable);
+        _originalAddFunction = new ClrFunction(Engine, "add", Add, 1, PropertyFlag.Configurable);
 
         const PropertyFlag PropertyFlags = PropertyFlag.Configurable | PropertyFlag.Writable;
         var properties = new PropertyDictionary(5, checkExistingKeys: false)
         {
             ["length"] = new(0, PropertyFlag.Configurable),
             ["constructor"] = new(_constructor, PropertyFlag.NonEnumerable),
-            ["delete"] = new(new ClrFunctionInstance(Engine, "delete", Delete, 1, PropertyFlag.Configurable), PropertyFlags),
+            ["delete"] = new(new ClrFunction(Engine, "delete", Delete, 1, PropertyFlag.Configurable), PropertyFlags),
             ["add"] = new(_originalAddFunction, PropertyFlags),
-            ["has"] = new(new ClrFunctionInstance(Engine, "has", Has, 1, PropertyFlag.Configurable), PropertyFlags),
+            ["has"] = new(new ClrFunction(Engine, "has", Has, 1, PropertyFlag.Configurable), PropertyFlags),
         };
         SetProperties(properties);
 

+ 6 - 6
Jint/Options.cs

@@ -116,7 +116,7 @@ namespace Jint
             {
                 engine.Realm.GlobalObject.SetProperty("System",
                     new PropertyDescriptor(new NamespaceReference(engine, "System"), PropertyFlag.AllForbidden));
-                engine.Realm.GlobalObject.SetProperty("importNamespace", new PropertyDescriptor(new ClrFunctionInstance(
+                engine.Realm.GlobalObject.SetProperty("importNamespace", new PropertyDescriptor(new ClrFunction(
                         engine,
                         "importNamespace",
                         (thisObj, arguments) =>
@@ -135,7 +135,7 @@ namespace Jint
             if (Modules.RegisterRequire)
             {
                 // Node js like loading of modules
-                engine.Realm.GlobalObject.SetProperty("require", new PropertyDescriptor(new ClrFunctionInstance(
+                engine.Realm.GlobalObject.SetProperty("require", new PropertyDescriptor(new ClrFunction(
                         engine,
                         "require",
                         (thisObj, arguments) =>
@@ -169,9 +169,9 @@ namespace Jint
 
             foreach (var overloads in methods.GroupBy(x => x.Name, StringComparer.Ordinal))
             {
-                PropertyDescriptor CreateMethodInstancePropertyDescriptor(ClrFunctionInstance? function)
+                PropertyDescriptor CreateMethodInstancePropertyDescriptor(ClrFunction? function)
                 {
-                    var instance = new MethodInfoFunctionInstance(
+                    var instance = new MethodInfoFunction(
                         engine,
                         objectType,
                         target: null,
@@ -187,7 +187,7 @@ namespace Jint
                 PropertyDescriptor? descriptorWithoutFallback = null;
 
                 if (prototype.HasOwnProperty(key) &&
-                    prototype.GetOwnProperty(key).Value is ClrFunctionInstance clrFunctionInstance)
+                    prototype.GetOwnProperty(key).Value is ClrFunction clrFunctionInstance)
                 {
                     descriptorWithFallback = CreateMethodInstancePropertyDescriptor(clrFunctionInstance);
                     prototype.SetOwnProperty(key, descriptorWithFallback);
@@ -204,7 +204,7 @@ namespace Jint
                     key = char.ToLower(overloads.Key[0], CultureInfo.InvariantCulture) + overloads.Key.Substring(1);
 
                     if (prototype.HasOwnProperty(key) &&
-                        prototype.GetOwnProperty(key).Value is ClrFunctionInstance lowerclrFunctionInstance)
+                        prototype.GetOwnProperty(key).Value is ClrFunction lowerclrFunctionInstance)
                     {
                         descriptorWithFallback ??= CreateMethodInstancePropertyDescriptor(lowerclrFunctionInstance);
                         prototype.SetOwnProperty(key, descriptorWithFallback);

+ 7 - 7
Jint/Pooling/ArgumentsInstancePool.cs

@@ -13,25 +13,25 @@ namespace Jint.Pooling
     {
         private const int PoolSize = 10;
         private readonly Engine _engine;
-        private readonly ObjectPool<ArgumentsInstance> _pool;
+        private readonly ObjectPool<JsArguments> _pool;
 
         public ArgumentsInstancePool(Engine engine)
         {
             _engine = engine;
-            _pool = new ObjectPool<ArgumentsInstance>(Factory, PoolSize);
+            _pool = new ObjectPool<JsArguments>(Factory, PoolSize);
         }
 
-        private ArgumentsInstance Factory()
+        private JsArguments Factory()
         {
-            return new ArgumentsInstance(_engine)
+            return new JsArguments(_engine)
             {
                 _prototype = _engine.Realm.Intrinsics.Object.PrototypeObject
             };
         }
 
-        public ArgumentsInstance Rent(JsValue[] argumentsList) => Rent(null, null, argumentsList, null, false);
+        public JsArguments Rent(JsValue[] argumentsList) => Rent(null, null, argumentsList, null, false);
 
-        public ArgumentsInstance Rent(
+        public JsArguments Rent(
             FunctionInstance? func,
             Key[]? formals,
             JsValue[] argumentsList,
@@ -43,7 +43,7 @@ namespace Jint.Pooling
             return obj;
         }
 
-        public void Return(ArgumentsInstance instance)
+        public void Return(JsArguments instance)
         {
             if (ReferenceEquals(instance, null))
             {

+ 4 - 4
Jint/Runtime/Descriptors/Specialized/ClrAccessDescriptor.cs

@@ -11,8 +11,8 @@ namespace Jint.Runtime.Descriptors.Specialized
         private readonly Engine _engine;
         private readonly Environment.BindingName _name;
 
-        private GetterFunctionInstance? _get;
-        private SetterFunctionInstance? _set;
+        private GetterFunction? _get;
+        private SetterFunction? _set;
 
         public ClrAccessDescriptor(
             DeclarativeEnvironment env,
@@ -26,8 +26,8 @@ namespace Jint.Runtime.Descriptors.Specialized
             _name = new Environment.BindingName(name);
         }
 
-        public override JsValue Get => _get ??= new GetterFunctionInstance(_engine, DoGet);
-        public override JsValue Set => _set ??= new SetterFunctionInstance(_engine, DoSet);
+        public override JsValue Get => _get ??= new GetterFunction(_engine, DoGet);
+        public override JsValue Set => _set ??= new SetterFunction(_engine, DoSet);
 
         private JsValue DoGet(JsValue n)
         {

+ 2 - 2
Jint/Runtime/Descriptors/Specialized/ReflectionDescriptor.cs

@@ -25,11 +25,11 @@ namespace Jint.Runtime.Descriptors.Specialized
 
             if (reflectionAccessor.Writable && engine.Options.Interop.AllowWrite)
             {
-                Set = new SetterFunctionInstance(_engine, DoSet);
+                Set = new SetterFunction(_engine, DoSet);
             }
             if (reflectionAccessor.Readable)
             {
-                Get = new GetterFunctionInstance(_engine, DoGet);
+                Get = new GetterFunction(_engine, DoGet);
             }
         }
 

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

@@ -77,7 +77,7 @@ namespace Jint.Runtime.Environments
         private void ThrowUninitializedThis()
         {
             var message = "Cannot access uninitialized 'this'";
-            if (NewTarget is ScriptFunctionInstance { _isClassConstructor: true, _constructorKind: ConstructorKind.Derived })
+            if (NewTarget is ScriptFunction { _isClassConstructor: true, _constructorKind: ConstructorKind.Derived })
             {
                 // help with better error message
                 message = "Must call super constructor in derived class before accessing 'this' or returning from derived constructor";

+ 2 - 2
Jint/Runtime/Host.cs

@@ -149,7 +149,7 @@ namespace Jint.Runtime
         /// </summary>
         internal virtual void FinishLoadingImportedModule(IScriptOrModule? referrer, ModuleRequest moduleRequest, PromiseCapability payload, JsPromise result)
         {
-            var onFulfilled = new ClrFunctionInstance(Engine, "", (thisObj, args) =>
+            var onFulfilled = new ClrFunction(Engine, "", (thisObj, args) =>
             {
                 var moduleRecord = GetImportedModule(referrer, moduleRequest);
                 try
@@ -164,7 +164,7 @@ namespace Jint.Runtime
                 return JsValue.Undefined;
             }, 0, PropertyFlag.Configurable);
 
-            var onRejected = new ClrFunctionInstance(Engine, "", (thisObj, args) =>
+            var onRejected = new ClrFunction(Engine, "", (thisObj, args) =>
             {
                 var error = args.At(0);
                 payload.Reject.Call(JsValue.Undefined, new [] { error });

+ 6 - 6
Jint/Runtime/Interop/ClrFunctionInstance.cs → Jint/Runtime/Interop/ClrFunction.cs

@@ -7,14 +7,14 @@ using Jint.Runtime.Descriptors;
 namespace Jint.Runtime.Interop;
 
 /// <summary>
-/// Wraps a Clr method into a FunctionInstance
+/// Wraps a CLR method into a JS function.
 /// </summary>
-public sealed class ClrFunctionInstance : FunctionInstance, IEquatable<ClrFunctionInstance>
+public sealed class ClrFunction : FunctionInstance, IEquatable<ClrFunction>
 {
     internal readonly Func<JsValue, JsValue[], JsValue> _func;
     private readonly bool _bubbleExceptions;
 
-    public ClrFunctionInstance(
+    public ClrFunction(
         Engine engine,
         string name,
         Func<JsValue, JsValue[], JsValue> func,
@@ -57,11 +57,11 @@ public sealed class ClrFunctionInstance : FunctionInstance, IEquatable<ClrFuncti
         }
     }
 
-    public override bool Equals(JsValue? other) => Equals(other as ClrFunctionInstance);
+    public override bool Equals(JsValue? other) => Equals(other as ClrFunction);
 
-    public override bool Equals(object? obj) => Equals(obj as ClrFunctionInstance);
+    public override bool Equals(object? obj) => Equals(obj as ClrFunction);
 
-    public bool Equals(ClrFunctionInstance? other)
+    public bool Equals(ClrFunction? other)
     {
         if (ReferenceEquals(null, other))
         {

+ 24 - 0
Jint/Runtime/Interop/GetterFunction.cs

@@ -0,0 +1,24 @@
+using Jint.Native;
+using Jint.Native.Function;
+
+namespace Jint.Runtime.Interop;
+
+/// <summary>
+/// Represents a FunctionInstance wrapping a CLR getter.
+/// </summary>
+internal sealed class GetterFunction: FunctionInstance
+{
+    private static readonly JsString _name = new JsString("get");
+    private readonly Func<JsValue, JsValue> _getter;
+
+    public GetterFunction(Engine engine, Func<JsValue, JsValue> getter)
+        : base(engine, engine.Realm, _name, FunctionThisMode.Global)
+    {
+        _getter = getter;
+    }
+
+    protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
+    {
+        return _getter(thisObject);
+    }
+}

+ 0 - 25
Jint/Runtime/Interop/GetterFunctionInstance.cs

@@ -1,25 +0,0 @@
-using Jint.Native;
-using Jint.Native.Function;
-
-namespace Jint.Runtime.Interop
-{
-    /// <summary>
-    /// Represents a FunctionInstance wrapping a Clr getter.
-    /// </summary>
-    public sealed class GetterFunctionInstance: FunctionInstance
-    {
-        private static readonly JsString _name = new JsString("get");
-        private readonly Func<JsValue, JsValue> _getter;
-
-        public GetterFunctionInstance(Engine engine, Func<JsValue, JsValue> getter)
-            : base(engine, engine.Realm, _name, FunctionThisMode.Global)
-        {
-            _getter = getter;
-        }
-
-        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
-        {
-            return _getter(thisObject);
-        }
-    }
-}

+ 4 - 4
Jint/Runtime/Interop/MethodInfoFunctionInstance.cs → Jint/Runtime/Interop/MethodInfoFunction.cs

@@ -7,21 +7,21 @@ using Jint.Native.Function;
 
 namespace Jint.Runtime.Interop
 {
-    internal sealed class MethodInfoFunctionInstance : FunctionInstance
+    internal sealed class MethodInfoFunction : FunctionInstance
     {
         private readonly Type _targetType;
         private readonly object? _target;
         private readonly string _name;
         private readonly MethodDescriptor[] _methods;
-        private readonly ClrFunctionInstance? _fallbackClrFunctionInstance;
+        private readonly ClrFunction? _fallbackClrFunctionInstance;
 
-        public MethodInfoFunctionInstance(
+        public MethodInfoFunction(
             Engine engine,
             Type targetType,
             object? target,
             string name,
             MethodDescriptor[] methods,
-            ClrFunctionInstance? fallbackClrFunctionInstance = null)
+            ClrFunction? fallbackClrFunctionInstance = null)
             : base(engine, engine.Realm, new JsString(name))
         {
             _targetType = targetType;

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

@@ -26,7 +26,7 @@ namespace Jint.Runtime.Interop
             if (_typeDescriptor.LengthProperty is not null)
             {
                 // create a forwarder to produce length from Count or Length if one of them is present
-                var functionInstance = new ClrFunctionInstance(engine, "length", GetLength);
+                var functionInstance = new ClrFunction(engine, "length", GetLength);
                 var descriptor = new GetSetPropertyDescriptor(functionInstance, Undefined, PropertyFlag.Configurable);
                 SetProperty(KnownKeys.Length, descriptor);
             }
@@ -205,7 +205,7 @@ namespace Jint.Runtime.Interop
             {
                 if (property == GlobalSymbolRegistry.Iterator && _typeDescriptor.Iterable)
                 {
-                    var iteratorFunction = new ClrFunctionInstance(
+                    var iteratorFunction = new ClrFunction(
                         Engine,
                         "iterator",
                         Iterator,

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

@@ -24,7 +24,7 @@ namespace Jint.Runtime.Interop.Reflection
 
         public override PropertyDescriptor CreatePropertyDescriptor(Engine engine, object target, bool enumerable = true)
         {
-            return new(new MethodInfoFunctionInstance(engine, _targetType, target, _name, _methods), PropertyFlag.AllForbidden);
+            return new(new MethodInfoFunction(engine, _targetType, target, _name, _methods), PropertyFlag.AllForbidden);
         }
     }
 }

+ 26 - 0
Jint/Runtime/Interop/SetterFunction.cs

@@ -0,0 +1,26 @@
+using Jint.Native;
+using Jint.Native.Function;
+
+namespace Jint.Runtime.Interop;
+
+/// <summary>
+/// Represents a FunctionInstance wrapping a CLR setter.
+/// </summary>
+internal sealed class SetterFunction : FunctionInstance
+{
+    private static readonly JsString _name = new JsString("set");
+    private readonly Action<JsValue, JsValue> _setter;
+
+    public SetterFunction(Engine engine, Action<JsValue, JsValue> setter)
+        : base(engine, engine.Realm, _name)
+    {
+        _setter = setter;
+    }
+
+    protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
+    {
+        _setter(thisObject, arguments[0]);
+
+        return Null;
+    }
+}

+ 0 - 27
Jint/Runtime/Interop/SetterFunctionInstance.cs

@@ -1,27 +0,0 @@
-using Jint.Native;
-using Jint.Native.Function;
-
-namespace Jint.Runtime.Interop
-{
-    /// <summary>
-    /// Represents a FunctionInstance wrapping a Clr setter.
-    /// </summary>
-    public sealed class SetterFunctionInstance : FunctionInstance
-    {
-        private static readonly JsString _name = new JsString("set");
-        private readonly Action<JsValue, JsValue> _setter;
-
-        public SetterFunctionInstance(Engine engine, Action<JsValue, JsValue> setter)
-            : base(engine, engine.Realm, _name)
-        {
-            _setter = setter;
-        }
-
-        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
-        {
-            _setter(thisObject, arguments[0]);
-
-            return Null;
-        }
-    }
-}

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

@@ -252,7 +252,7 @@ namespace Jint.Runtime.Interop
             {
                 if (property == GlobalSymbolRegistry.HasInstance)
                 {
-                    var hasInstanceFunction = new ClrFunctionInstance(
+                    var hasInstanceFunction = new ClrFunction(
                         Engine,
                         "[Symbol.hasInstance]",
                         HasInstance,

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

@@ -271,7 +271,7 @@ namespace Jint.Runtime.Interpreter.Expressions
             thisER.BindThisValue(result);
             var F = thisER._functionObject;
 
-            result.InitializeInstanceElements((ScriptFunctionInstance) F);
+            result.InitializeInstanceElements((ScriptFunction) F);
 
             return result;
         }

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

@@ -21,7 +21,7 @@ namespace Jint.Runtime.Interpreter.Expressions
 
         public override JsValue GetValue(EvaluationContext context)
         {
-            ScriptFunctionInstance closure;
+            ScriptFunction closure;
             var functionName = _function.Name ?? "";
             if (!_function.Function.Generator)
             {
@@ -40,7 +40,7 @@ namespace Jint.Runtime.Interpreter.Expressions
         /// <summary>
         /// https://tc39.es/ecma262/#sec-runtime-semantics-instantiateordinaryfunctionexpression
         /// </summary>
-        private ScriptFunctionInstance InstantiateOrdinaryFunctionExpression(EvaluationContext context, string? name = "")
+        private ScriptFunction InstantiateOrdinaryFunctionExpression(EvaluationContext context, string? name = "")
         {
             var engine = context.Engine;
             var runningExecutionContext = engine.ExecutionContext;
@@ -82,7 +82,7 @@ namespace Jint.Runtime.Interpreter.Expressions
         /// <summary>
         /// https://tc39.es/ecma262/#sec-runtime-semantics-instantiateasyncfunctionexpression
         /// </summary>
-        private ScriptFunctionInstance InstantiateAsyncFunctionExpression(EvaluationContext context, string? name = "")
+        private ScriptFunction InstantiateAsyncFunctionExpression(EvaluationContext context, string? name = "")
         {
             var engine = context.Engine;
             var runningExecutionContext = engine.ExecutionContext;
@@ -121,7 +121,7 @@ namespace Jint.Runtime.Interpreter.Expressions
         /// <summary>
         /// https://tc39.es/ecma262/#sec-runtime-semantics-instantiategeneratorfunctionexpression
         /// </summary>
-        private ScriptFunctionInstance InstantiateGeneratorFunctionExpression(EvaluationContext context, string? name)
+        private ScriptFunction InstantiateGeneratorFunctionExpression(EvaluationContext context, string? name)
         {
             // TODO generators
             return InstantiateOrdinaryFunctionExpression(context, name);

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

@@ -98,7 +98,7 @@ internal sealed class JintIdentifierExpression : JintExpression
         }
 
         // make sure arguments access freezes state
-        if (value is ArgumentsInstance argumentsInstance)
+        if (value is JsArguments argumentsInstance)
         {
             argumentsInstance.Materialize();
         }

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

@@ -37,7 +37,7 @@ internal sealed class JintFunctionDefinition
     internal Completion EvaluateBody(EvaluationContext context, FunctionInstance functionObject, JsValue[] argumentsList)
     {
         Completion result;
-        ArgumentsInstance? argumentsInstance = null;
+        JsArguments? argumentsInstance = null;
         if (Function.Expression)
         {
             // https://tc39.es/ecma262/#sec-runtime-semantics-evaluateconcisebody

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä