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