|
@@ -31,7 +31,7 @@ namespace Jint.Native.Function
|
|
JintFunctionDefinition function,
|
|
JintFunctionDefinition function,
|
|
LexicalEnvironment scope,
|
|
LexicalEnvironment scope,
|
|
FunctionThisMode thisMode)
|
|
FunctionThisMode thisMode)
|
|
- : this(engine, !string.IsNullOrWhiteSpace(function.Name) ? new JsString(function.Name) : null, thisMode)
|
|
|
|
|
|
+ : this(engine, !string.IsNullOrWhiteSpace(function.Name) ? new JsString(function.Name) : null, thisMode)
|
|
{
|
|
{
|
|
_functionDefinition = function;
|
|
_functionDefinition = function;
|
|
_environment = scope;
|
|
_environment = scope;
|
|
@@ -51,6 +51,13 @@ namespace Jint.Native.Function
|
|
_thisMode = thisMode;
|
|
_thisMode = thisMode;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ protected FunctionInstance(
|
|
|
|
+ Engine engine,
|
|
|
|
+ JsString name)
|
|
|
|
+ : this(engine, name, FunctionThisMode.Global, ObjectClass.Function)
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Executed when a function object is used as a function
|
|
/// Executed when a function object is used as a function
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -60,7 +67,7 @@ namespace Jint.Native.Function
|
|
public abstract JsValue Call(JsValue thisObject, JsValue[] arguments);
|
|
public abstract JsValue Call(JsValue thisObject, JsValue[] arguments);
|
|
|
|
|
|
public bool Strict => _thisMode == FunctionThisMode.Strict;
|
|
public bool Strict => _thisMode == FunctionThisMode.Strict;
|
|
-
|
|
|
|
|
|
+
|
|
public virtual bool HasInstance(JsValue v)
|
|
public virtual bool HasInstance(JsValue v)
|
|
{
|
|
{
|
|
if (!(v is ObjectInstance o))
|
|
if (!(v is ObjectInstance o))
|
|
@@ -212,7 +219,7 @@ namespace Jint.Native.Function
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (name is JsSymbol symbol)
|
|
if (name is JsSymbol symbol)
|
|
{
|
|
{
|
|
name = symbol._value.IsUndefined()
|
|
name = symbol._value.IsUndefined()
|
|
@@ -258,7 +265,7 @@ namespace Jint.Native.Function
|
|
{
|
|
{
|
|
name = TypeConverter.ToString(nameValue);
|
|
name = TypeConverter.ToString(nameValue);
|
|
}
|
|
}
|
|
- return "function " + name + "() {{[native code]}}";
|
|
|
|
|
|
+ return "function " + name + "() {{[native code]}}";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|