Browse Source

Hide Call method from public API (#1062)

* Hide Call method from public API
* Add support for supplying thisObj
Marko Lahma 3 years ago
parent
commit
bbc5bab0b5
36 changed files with 145 additions and 42 deletions
  1. 1 1
      Jint.Tests/Runtime/Domain/UuidConstructor.cs
  2. 47 3
      Jint.Tests/Runtime/FunctionTests.cs
  3. 43 0
      Jint/Engine.cs
  4. 18 3
      Jint/JsValueExtensions.cs
  5. 1 1
      Jint/Native/Array/ArrayConstructor.cs
  6. 1 1
      Jint/Native/ArrayBuffer/ArrayBufferConstructor.cs
  7. 1 1
      Jint/Native/BigInt/BigIntConstructor.cs
  8. 1 1
      Jint/Native/Boolean/BooleanConstructor.cs
  9. 1 1
      Jint/Native/DataView/DataViewConstructor.cs
  10. 1 1
      Jint/Native/Date/DateConstructor.cs
  11. 1 1
      Jint/Native/Error/ErrorConstructor.cs
  12. 1 1
      Jint/Native/Function/EvalFunctionInstance.cs
  13. 1 1
      Jint/Native/Function/FunctionConstructor.cs
  14. 5 4
      Jint/Native/Function/FunctionInstance.cs
  15. 1 1
      Jint/Native/Function/FunctionPrototype.cs
  16. 1 1
      Jint/Native/Function/ScriptFunctionInstance.cs
  17. 1 1
      Jint/Native/Function/ThrowTypeError.cs
  18. 1 1
      Jint/Native/Map/MapConstructor.cs
  19. 1 1
      Jint/Native/Number/NumberConstructor.cs
  20. 1 1
      Jint/Native/Object/ObjectConstructor.cs
  21. 1 1
      Jint/Native/Promise/PromiseConstructor.cs
  22. 1 1
      Jint/Native/Proxy/ProxyConstructor.cs
  23. 1 1
      Jint/Native/RegExp/RegExpConstructor.cs
  24. 1 1
      Jint/Native/Set/SetConstructor.cs
  25. 1 1
      Jint/Native/String/StringConstructor.cs
  26. 1 1
      Jint/Native/Symbol/SymbolConstructor.cs
  27. 1 1
      Jint/Native/TypedArray/IntrinsicTypedArrayConstructor.cs
  28. 1 1
      Jint/Native/TypedArray/TypedArrayConstructor.cs
  29. 1 1
      Jint/Native/WeakMap/WeakMapConstructor.cs
  30. 1 1
      Jint/Native/WeakSet/WeakSetConstructor.cs
  31. 1 1
      Jint/Runtime/Interop/ClrFunctionInstance.cs
  32. 1 1
      Jint/Runtime/Interop/DelegateWrapper.cs
  33. 1 1
      Jint/Runtime/Interop/GetterFunctionInstance.cs
  34. 1 1
      Jint/Runtime/Interop/MethodInfoFunctionInstance.cs
  35. 1 1
      Jint/Runtime/Interop/SetterFunctionInstance.cs
  36. 1 1
      Jint/Runtime/Interop/TypeReference.cs

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

@@ -55,7 +55,7 @@ namespace Jint.Tests.Runtime.Domain
             return obj;
             return obj;
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments) => Construct(arguments, null);
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments) => Construct(arguments, null);
 
 
         public void Configure()
         public void Configure()
         {
         {

+ 47 - 3
Jint.Tests/Runtime/FunctionTests.cs

@@ -1,6 +1,7 @@
 using System;
 using System;
 using Jint.Native;
 using Jint.Native;
 using Jint.Native.Array;
 using Jint.Native.Array;
+using Jint.Native.Function;
 using Jint.Runtime;
 using Jint.Runtime;
 using Jint.Runtime.Interop;
 using Jint.Runtime.Interop;
 using Xunit;
 using Xunit;
@@ -125,7 +126,6 @@ assertEqual(booleanCount, 1);
             Assert.Equal(123, arrayInstance[1]);
             Assert.Equal(123, arrayInstance[1]);
         }
         }
 
 
-
         [Fact]
         [Fact]
         public void FunctionInstancesCanBePassedToHost()
         public void FunctionInstancesCanBePassedToHost()
         {
         {
@@ -159,7 +159,6 @@ assertEqual(booleanCount, 1);
             Assert.Equal(30, engine.Evaluate("a"));
             Assert.Equal(30, engine.Evaluate("a"));
         }
         }
 
 
-
         [Fact]
         [Fact]
         public void BoundFunctionsCanBePassedToHost()
         public void BoundFunctionsCanBePassedToHost()
         {
         {
@@ -214,7 +213,6 @@ assertEqual(booleanCount, 1);
             Assert.Equal(false, ev(JsValue.Undefined, new JsValue[] { JsValue.Undefined }));
             Assert.Equal(false, ev(JsValue.Undefined, new JsValue[] { JsValue.Undefined }));
         }
         }
 
 
-
         [Fact]
         [Fact]
         public void FunctionsShouldResolveToSameReference()
         public void FunctionsShouldResolveToSameReference()
         {
         {
@@ -225,5 +223,51 @@ assertEqual(booleanCount, 1);
                 equal(testFn, testFn);
                 equal(testFn, testFn);
             ");
             ");
         }
         }
+        
+        [Fact]
+        public void CanInvokeCallForFunctionInstance()
+        {
+            var engine = new Engine();
+
+            engine.Evaluate(@"
+                (function () {
+                    function foo(a = 123) { return a; }
+                    foo()
+                })")
+                .As<FunctionInstance>().Call();
+
+            var result = engine.Evaluate(@"
+                (function () {
+                    class Foo { test() { return 123 } }
+                    let f = new Foo()
+                    return f.test()
+                })")
+                .As<FunctionInstance>().Call();
+
+            Assert.True(result.IsInteger());
+            Assert.Equal(123, result.AsInteger());
+        }
+
+        [Fact]
+        public void CanInvokeFunctionViaEngineInstance()
+        {
+            var engine = new Engine();
+
+            var function = engine.Evaluate("function bar(a) { return a; }; bar;");
+
+            Assert.Equal(123, engine.Call(function, 123));
+            Assert.Equal(123, engine.Call("bar", 123));
+        }
+
+        [Fact]
+        public void CanInvokeFunctionViaEngineInstanceWithCustomThisObj()
+        {
+            var engine = new Engine();
+
+            var function = engine.Evaluate("function baz() { return this; }; baz;");
+
+            Assert.Equal("I'm this!", TypeConverter.ToString(engine.Call(function, "I'm this!", Arguments.Empty)));
+            Assert.Equal("I'm this!", TypeConverter.ToString(function.Call("I'm this!", Arguments.Empty)));
+        }
     }
     }
 }
 }

+ 43 - 0
Jint/Engine.cs

@@ -1211,6 +1211,49 @@ namespace Jint
             _executionContexts.ReplaceTopVariableEnvironment(newEnv);
             _executionContexts.ReplaceTopVariableEnvironment(newEnv);
         }
         }
 
 
+        /// <summary>
+        /// Invokes the named callable and returns the resulting object.
+        /// </summary>
+        /// <param name="callableName">The name of the callable.</param>
+        /// <param name="arguments">The arguments of the call.</param>
+        /// <returns>The value returned by the call.</returns>
+        public JsValue Call(string callableName, params JsValue[] arguments)
+        {
+            var callable = Evaluate(callableName);
+            return Call(callable, arguments);
+        }
+
+        /// <summary>
+        /// Invokes the callable and returns the resulting object.
+        /// </summary>
+        /// <param name="callable">The callable.</param>
+        /// <param name="arguments">The arguments of the call.</param>
+        /// <returns>The value returned by the call.</returns>
+        public JsValue Call(JsValue callable, params JsValue[] arguments)
+            => Call(callable, thisObject: JsValue.Undefined, arguments);
+
+        /// <summary>
+        /// Invokes the callable and returns the resulting object.
+        /// </summary>
+        /// <param name="callable">The callable.</param>
+        /// <param name="thisObject">Value bound as this.</param>
+        /// <param name="arguments">The arguments of the call.</param>
+        /// <returns>The value returned by the call.</returns>
+        public JsValue Call(JsValue callable, JsValue thisObject, JsValue[] arguments)
+        {
+            JsValue Callback()
+            {
+                if (!callable.IsCallable)
+                {
+                    ExceptionHelper.ThrowArgumentException(callable + " is not callable");
+                }
+
+                return Call((ICallable) callable, thisObject, arguments, null);
+            }
+
+            return ExecuteWithConstraints(Options.Strict, Callback);
+        }
+
         internal JsValue Call(ICallable callable, JsValue thisObject, JsValue[] arguments, JintExpression expression)
         internal JsValue Call(ICallable callable, JsValue thisObject, JsValue[] arguments, JintExpression expression)
         {
         {
             if (callable is FunctionInstance functionInstance)
             if (callable is FunctionInstance functionInstance)

+ 18 - 3
Jint/JsValueExtensions.cs

@@ -434,11 +434,26 @@ namespace Jint
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static JsValue Call(this JsValue value, params JsValue[] arguments)
         public static JsValue Call(this JsValue value, params JsValue[] arguments)
         {
         {
-            if (!value.IsCallable)
+            if (value is not ObjectInstance objectInstance)
             {
             {
-                ExceptionHelper.ThrowArgumentException(value + " is not callable");
+                ExceptionHelper.ThrowArgumentException(value + " is not object");
+                return null;
             }
             }
-            return ((ICallable) value).Call(JsValue.Undefined, arguments);
+
+            return objectInstance.Engine.Call(value, arguments);
+        }
+
+        [Pure]
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static JsValue Call(this JsValue value, JsValue thisObj, params JsValue[] arguments)
+        {
+            if (value is not ObjectInstance objectInstance)
+            {
+                ExceptionHelper.ThrowArgumentException(value + " is not object");
+                return null;
+            }
+
+            return objectInstance.Engine.Call(value, thisObj, arguments);
         }
         }
 
 
         /// <summary>
         /// <summary>

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

@@ -263,7 +263,7 @@ namespace Jint.Native.Array
             return oi.IsArray();
             return oi.IsArray();
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             return Construct(arguments, thisObject);
             return Construct(arguments, thisObject);
         }
         }

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

@@ -65,7 +65,7 @@ namespace Jint.Native.ArrayBuffer
             return thisObject;
             return thisObject;
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_realm, "Constructor ArrayBuffer requires 'new'");
             ExceptionHelper.ThrowTypeError(_realm, "Constructor ArrayBuffer requires 'new'");
             return Undefined;
             return Undefined;

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

@@ -68,7 +68,7 @@ public sealed class BigIntConstructor : FunctionInstance, IConstructor
         return result;
         return result;
     }
     }
 
 
-    public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+    protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
     {
     {
         if (arguments.Length == 0)
         if (arguments.Length == 0)
         {
         {

+ 1 - 1
Jint/Native/Boolean/BooleanConstructor.cs

@@ -24,7 +24,7 @@ namespace Jint.Native.Boolean
 
 
         public BooleanPrototype PrototypeObject { get; }
         public BooleanPrototype PrototypeObject { get; }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             if (arguments.Length == 0)
             if (arguments.Length == 0)
             {
             {

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

@@ -28,7 +28,7 @@ namespace Jint.Native.DataView
 
 
         public DataViewPrototype PrototypeObject { get; }
         public DataViewPrototype PrototypeObject { get; }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_realm, "Constructor DataView requires 'new'");
             ExceptionHelper.ThrowTypeError(_realm, "Constructor DataView requires 'new'");
             return Undefined;
             return Undefined;

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

@@ -154,7 +154,7 @@ namespace Jint.Native.Date
             return System.Math.Floor((DateTime.UtcNow - Epoch).TotalMilliseconds);
             return System.Math.Floor((DateTime.UtcNow - Epoch).TotalMilliseconds);
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             return PrototypeObject.ToString(Construct(Arguments.Empty, thisObject), Arguments.Empty);
             return PrototypeObject.ToString(Construct(Arguments.Empty, thisObject), Arguments.Empty);
         }
         }

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

@@ -27,7 +27,7 @@ namespace Jint.Native.Error
 
 
         public ErrorPrototype PrototypeObject { get; }
         public ErrorPrototype PrototypeObject { get; }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             return Construct(arguments, this);
             return Construct(arguments, this);
         }
         }

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

@@ -26,7 +26,7 @@ namespace Jint.Native.Function
             _length = new PropertyDescriptor(JsNumber.PositiveOne, PropertyFlag.Configurable);
             _length = new PropertyDescriptor(JsNumber.PositiveOne, PropertyFlag.Configurable);
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             var callerRealm = _engine.ExecutionContext.Realm;
             var callerRealm = _engine.ExecutionContext.Realm;
             var x = arguments.At(0);
             var x = arguments.At(0);

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

@@ -31,7 +31,7 @@ namespace Jint.Native.Function
 
 
         public FunctionPrototype PrototypeObject { get; }
         public FunctionPrototype PrototypeObject { get; }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             return Construct(arguments, thisObject);
             return Construct(arguments, thisObject);
         }
         }

+ 5 - 4
Jint/Native/Function/FunctionInstance.cs

@@ -70,13 +70,14 @@ namespace Jint.Native.Function
         // for example RavenDB wants to inspect this
         // for example RavenDB wants to inspect this
         public IFunction FunctionDeclaration => _functionDefinition.Function;
         public IFunction FunctionDeclaration => _functionDefinition.Function;
 
 
+        internal override bool IsCallable => true;
+
+        JsValue ICallable.Call(JsValue thisObject, JsValue[] arguments) => Call(thisObject, arguments);
+
         /// <summary>
         /// <summary>
         /// Executed when a function object is used as a function
         /// Executed when a function object is used as a function
         /// </summary>
         /// </summary>
-        /// <param name="thisObject"></param>
-        /// <param name="arguments"></param>
-        /// <returns></returns>
-        public abstract JsValue Call(JsValue thisObject, JsValue[] arguments);
+        protected internal abstract JsValue Call(JsValue thisObject, JsValue[] arguments);
 
 
         public bool Strict => _thisMode == FunctionThisMode.Strict;
         public bool Strict => _thisMode == FunctionThisMode.Strict;
 
 

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

@@ -202,7 +202,7 @@ namespace Jint.Native.Function
             return result;
             return result;
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             return Undefined;
             return Undefined;
         }
         }

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

@@ -52,7 +52,7 @@ namespace Jint.Native.Function
         /// <summary>
         /// <summary>
         /// https://tc39.es/ecma262/#sec-ecmascript-function-objects-call-thisargument-argumentslist
         /// https://tc39.es/ecma262/#sec-ecmascript-function-objects-call-thisargument-argumentslist
         /// </summary>
         /// </summary>
-        public override JsValue Call(JsValue thisArgument, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisArgument, JsValue[] arguments)
         {
         {
             var strict = _thisMode == FunctionThisMode.Strict || _engine._isStrict;
             var strict = _thisMode == FunctionThisMode.Strict || _engine._isStrict;
             using (new StrictModeScope(strict, true))
             using (new StrictModeScope(strict, true))

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

@@ -14,7 +14,7 @@ namespace Jint.Native.Function
             PreventExtensions();
             PreventExtensions();
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_realm);
             ExceptionHelper.ThrowTypeError(_realm);
             return null;
             return null;

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

@@ -42,7 +42,7 @@ namespace Jint.Native.Map
             return thisObject;
             return thisObject;
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_realm, "Constructor Map requires 'new'");
             ExceptionHelper.ThrowTypeError(_realm, "Constructor Map requires 'new'");
             return null;
             return null;

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

@@ -112,7 +112,7 @@ namespace Jint.Native.Number
             return System.Math.Abs(integer) <= MaxSafeInteger;
             return System.Math.Abs(integer) <= MaxSafeInteger;
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             var n = ProcessFirstParameter(arguments);
             var n = ProcessFirstParameter(arguments);
             return n;
             return n;

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

@@ -131,7 +131,7 @@ namespace Jint.Native.Object
         /// <summary>
         /// <summary>
         /// https://tc39.es/ecma262/#sec-object-value
         /// https://tc39.es/ecma262/#sec-object-value
         /// </summary>
         /// </summary>
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             if (arguments.Length == 0)
             if (arguments.Length == 0)
             {
             {

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

@@ -65,7 +65,7 @@ namespace Jint.Native.Promise
             SetSymbols(symbols);
             SetSymbols(symbols);
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_realm, "Constructor Promise requires 'new'");
             ExceptionHelper.ThrowTypeError(_realm, "Constructor Promise requires 'new'");
             return null;
             return null;

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

@@ -33,7 +33,7 @@ namespace Jint.Native.Proxy
             SetProperties(properties);
             SetProperties(properties);
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_realm, "Constructor Proxy requires 'new'");
             ExceptionHelper.ThrowTypeError(_realm, "Constructor Proxy requires 'new'");
             return null;
             return null;

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

@@ -37,7 +37,7 @@ namespace Jint.Native.RegExp
             SetSymbols(symbols);
             SetSymbols(symbols);
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             return Construct(arguments, thisObject);
             return Construct(arguments, thisObject);
         }
         }

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

@@ -42,7 +42,7 @@ namespace Jint.Native.Set
             return thisObject;
             return thisObject;
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_engine.Realm, "Constructor Set requires 'new'");
             ExceptionHelper.ThrowTypeError(_engine.Realm, "Constructor Set requires 'new'");
             return null;
             return null;

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

@@ -139,7 +139,7 @@ namespace Jint.Native.String
             return result.ToString();
             return result.ToString();
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             if (arguments.Length == 0)
             if (arguments.Length == 0)
             {
             {

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

@@ -59,7 +59,7 @@ namespace Jint.Native.Symbol
         /// <summary>
         /// <summary>
         /// http://www.ecma-international.org/ecma-262/6.0/index.html#sec-symbol-description
         /// http://www.ecma-international.org/ecma-262/6.0/index.html#sec-symbol-description
         /// </summary>
         /// </summary>
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             var description = arguments.At(0);
             var description = arguments.At(0);
             var descString = description.IsUndefined()
             var descString = description.IsUndefined()

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

@@ -183,7 +183,7 @@ namespace Jint.Native.TypedArray
             return thisObject;
             return thisObject;
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_realm, "Abstract class TypedArray not directly constructable");
             ExceptionHelper.ThrowTypeError(_realm, "Abstract class TypedArray not directly constructable");
             return Undefined;
             return Undefined;

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

@@ -44,7 +44,7 @@ namespace Jint.Native.TypedArray
             SetProperties(properties);
             SetProperties(properties);
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_realm, "Abstract class TypedArray not directly constructable");
             ExceptionHelper.ThrowTypeError(_realm, "Abstract class TypedArray not directly constructable");
             return Undefined;
             return Undefined;

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

@@ -25,7 +25,7 @@ namespace Jint.Native.WeakMap
 
 
         public WeakMapPrototype PrototypeObject { get; }
         public WeakMapPrototype PrototypeObject { get; }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_realm, "Constructor WeakMap requires 'new'");
             ExceptionHelper.ThrowTypeError(_realm, "Constructor WeakMap requires 'new'");
             return null;
             return null;

+ 1 - 1
Jint/Native/WeakSet/WeakSetConstructor.cs

@@ -24,7 +24,7 @@ namespace Jint.Native.WeakSet
 
 
         public WeakSetPrototype PrototypeObject { get; }
         public WeakSetPrototype PrototypeObject { get; }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             ExceptionHelper.ThrowTypeError(_realm, "Constructor WeakSet requires 'new'");
             ExceptionHelper.ThrowTypeError(_realm, "Constructor WeakSet requires 'new'");
             return null;
             return null;

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

@@ -31,7 +31,7 @@ namespace Jint.Runtime.Interop
                 : new PropertyDescriptor(JsNumber.Create(length), lengthFlags);
                 : new PropertyDescriptor(JsNumber.Create(length), lengthFlags);
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments) => _func(thisObject, arguments);
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments) => _func(thisObject, arguments);
 
 
         public override bool Equals(JsValue obj)
         public override bool Equals(JsValue obj)
         {
         {

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

@@ -37,7 +37,7 @@ namespace Jint.Runtime.Interop
             }
             }
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] jsArguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] jsArguments)
         {
         {
             var parameterInfos = _d.Method.GetParameters();
             var parameterInfos = _d.Method.GetParameters();
 
 

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

@@ -18,7 +18,7 @@ namespace Jint.Runtime.Interop
             _getter = getter;
             _getter = getter;
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             return _getter(thisObject);
             return _getter(thisObject);
         }
         }

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

@@ -124,7 +124,7 @@ namespace Jint.Runtime.Interop
             return genericMethodInfo;
             return genericMethodInfo;
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] jsArguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] jsArguments)
         {
         {
             JsValue[] ArgumentProvider(MethodDescriptor method)
             JsValue[] ArgumentProvider(MethodDescriptor method)
             {
             {

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

@@ -18,7 +18,7 @@ namespace Jint.Runtime.Interop
             _setter = setter;
             _setter = setter;
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             _setter(thisObject, arguments[0]);
             _setter(thisObject, arguments[0]);
 
 

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

@@ -40,7 +40,7 @@ namespace Jint.Runtime.Interop
             return new TypeReference(engine, type);
             return new TypeReference(engine, type);
         }
         }
 
 
-        public override JsValue Call(JsValue thisObject, JsValue[] arguments)
+        protected internal override JsValue Call(JsValue thisObject, JsValue[] arguments)
         {
         {
             // direct calls on a TypeReference constructor object is equivalent to the new operator
             // direct calls on a TypeReference constructor object is equivalent to the new operator
             return Construct(arguments);
             return Construct(arguments);