Example #1
0
        public UserFunction CreateFunction(Scope scope, Lambda lambda)
        {
            var obj = new UserFunction(scope, lambda);

            var protoObj = ObjectConstructor.Construct();
            protoObj.SetOwnProperty("constructor", obj);

            obj.Context = this;
            obj.Class = ObjClass.Function;
            obj.Prototype = FunctionConstructor.Function_prototype;
            obj.SetOwnProperty("prototype", protoObj);

            return obj;
        }
Example #2
0
 public UserFunction(Scope scope, Lambda lambda)
 {
     Scope = scope;
     Lambda = lambda;
     SetOwnProperty("length", (double) lambda.Params.Length);
 }
Example #3
0
 public int Push(Lambda func)
 {
     Functions.Add(func);
     return Functions.Count - 1;
 }