public Call ( ScriptEngine engine, object thisObject ) : object | ||
engine | ScriptEngine | The associated script engine. |
thisObject | object | The value of the |
return | object |
// OVERRIDES //_________________________________________________________________________________________ /// <summary> /// Calls this function, passing in the given "this" value and zero or more arguments. /// </summary> /// <param name="thisObject"> The value of the "this" keyword within the function. </param> /// <param name="arguments"> An array of argument values. </param> /// <returns> The value that was returned from the function. </returns> public override object CallLateBound(object thisObject, params object[] arguments) { if (Engine.CompatibilityMode == CompatibilityMode.ECMAScript3) { // Convert null or undefined to the global object. if (TypeUtilities.IsUndefined(thisObject) || thisObject == Null.Value) { thisObject = Engine.Global; } else { thisObject = TypeConverter.ToObject(Engine, thisObject); } } try { return(m_callBinder.Call(Engine, m_thisBinding ?? thisObject, arguments)); } catch (JavaScriptException ex) { if (ex.FunctionName == null && ex.SourcePath == null && ex.LineNumber == 0) { ex.FunctionName = DisplayName; ex.SourcePath = "native"; ex.PopulateStackTrace(); } throw; } }
/// <summary> /// Creates an object, using this function as the constructor. /// </summary> /// <param name="argumentValues"> An array of argument values. </param> /// <returns> The object that was created. </returns> public override ObjectInstance ConstructLateBound(params object[] argumentValues) { if (m_constructBinder == null) { throw new JavaScriptException(Engine, "TypeError", "Objects cannot be constructed from built-in functions"); } return((ObjectInstance)m_constructBinder.Call(Engine, this, argumentValues)); }