예제 #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;
        }
예제 #2
0
 public UserFunction(Scope scope, Lambda lambda)
 {
     Scope = scope;
     Lambda = lambda;
     SetOwnProperty("length", (double) lambda.Params.Length);
 }
예제 #3
0
 public int Push(Lambda func)
 {
     Functions.Add(func);
     return Functions.Count - 1;
 }