Jurassic.Library.ClrFunction.ClrFunction C# (CSharp) Method

ClrFunction() private method

Creates a new instance of a function which calls the given delegate.
private ClrFunction ( ObjectInstance prototype, Delegate delegateToCall, string name = null, int length = -1 ) : System
prototype ObjectInstance The next object in the prototype chain.
delegateToCall System.Delegate The delegate to call.
name string The name of the function. Pass null to use the name of the /// delegate for the function name.
length int The "typical" number of arguments expected by the function. Pass /// -1 to use the number of arguments expected by the delegate.
return System
        internal ClrFunction(ObjectInstance prototype, Delegate delegateToCall, string name = null, int length = -1)
            : base(prototype)
        {
            // Initialize the [[Call]] method.
            this.callBinder = new JSBinder(new JSBinderMethod(delegateToCall.Method));

            // If the delegate has a class instance, use that to call the method.
            this.thisBinding = delegateToCall.Target;

            // Add function properties.
            this.FastSetProperty("name", name != null ? name : this.callBinder.Name, PropertyAttributes.Configurable);
            this.FastSetProperty("length", length >= 0 ? length : this.callBinder.FunctionLength, PropertyAttributes.Configurable);
            //this.FastSetProperty("prototype", this.Engine.Object.Construct());
            //this.InstancePrototype.FastSetProperty("constructor", this, PropertyAttributes.NonEnumerable);
        }

Same methods

ClrFunction::ClrFunction ( ObjectInstance prototype, Binder binder ) : System
ClrFunction::ClrFunction ( ObjectInstance prototype, IEnumerable methods, string name = null, int length = -1 ) : System
ClrFunction::ClrFunction ( ObjectInstance prototype, string name, ObjectInstance instancePrototype ) : System