public JSDebugFunction(JSDebugFunctionDef def, JSEnvRec Scope) : base(JSContext.CurrentGlobalContext.FunctionPrototype, JSContext.CurrentGlobalContext.FunctionCtor) { this.def = def; base.SetDataProp("prototype", new JSObject(), true, false, false); this.Scope = Scope; base.SetDataProp("length", (double)def.param_names.Length, false, false, false); }
public JSDebugFunction(JSDebugFunctionDef def, JSEnvRec Scope) : base(JSContext.CurrentGlobalContext.FunctionPrototype, JSContext.CurrentGlobalContext.FunctionCtor) { this.def = def; base.SetDataProp("prototype", new JSObject(), true, false, false); this.Scope = Scope; base.SetDataProp("length", (double) def.param_names.Length, false, false, false); }
internal JSFunctionObject(functionExpressionNode def, JSEnvRec Scope) : base(JSContext.CurrentGlobalContext.FunctionPrototype, JSContext.CurrentGlobalContext.FunctionCtor) { this.FunctionDef = def; JSObject p = new JSObject(); p.SetDataProp("constructor", this, true, false, true); base.SetDataProp("prototype", p, true, false, false); this.Scope = Scope; }
public JSContext(JSContext Parent) { this.Parent = Parent; if (Parent != null) { this.LexicalEnv = Parent.LexicalEnv; this.VariableEnv = Parent.VariableEnv; } }
public override bool DeleteProperty(string Key, bool Throw) { for (JSEnvRec l = this.LexicalEnv; l != null; l = l.Parent) { if (l.HasBinding(Key)) { return(l.DeleteBinding(Key, Throw)); } } return(true); }
public bool HasBinding(string key) { for (JSEnvRec lex = this.LexicalEnv; lex != null; lex = lex.Parent) { if (lex.HasBinding(key)) { return(true); } } return(false); }
public JSValue GetBindingValue(string key) { for (JSEnvRec lex = this.LexicalEnv; lex != null; lex = lex.Parent) { JSValue r; if (lex.TryGetBindingValue(key, out r)) { return(r); } } throw new JSRuntimeException("ReferenceError", key + " is not defined"); }
protected internal virtual JSValue GetFunctionReference(int key, JSEnvRec r) { JSContext ctx = this; if (ctx.Source == null) { return(this.Parent.GetFunctionReference(key, r)); } functionExpressionNode fncNode = ctx.Source.FunctionList[key]; JSFunctionObject fnc = new JSFunctionObject(fncNode, r); fnc.SetDataProp("length", (double)fncNode.ParameterList.Names.Length, false, false, false); return(fnc); }
internal virtual JSValue GetFunctionWithThis(string key, out JSValue lThisObj) { for (JSEnvRec lex = this.LexicalEnv; lex != null; lex = lex.Parent) { JSValue r; if (lex.TryGetBindingValue(key, out r)) { if (lex is JSObjectScope) { lThisObj = ((JSObjectScope)lex).ScopeObject; return(r); } lThisObj = JSUndefined.Instance; return(r); } } throw new JSRuntimeException("ReferenceError", key + " is not defined"); }
public JSFunctionContext(JSValue ThisObj, JSArgs Args, ParameterList parameterList, JSContext context, JSEnvRec Scope) : base(context) { if (!((ThisObj is JSNull) || (ThisObj is JSUndefined))) { this.ThisObj = ThisObj; } this.Args = Args; this.parameterList = parameterList; base.LexicalEnv = new JSDeclScope(Scope); base.VariableEnv = base.LexicalEnv; base.CreateMutableBinding("arguments"); base.SetMutableBinding("arguments", Args); int m = parameterList.Names.Length; for (int i = 0; i < m; i++) { base.CreateMutableBinding(parameterList.Names[i]); base.SetMutableBinding(parameterList.Names[i], Args[i]); } }
public JSEnvRec(JSEnvRec Parent) { this.Parent = Parent; }
public JSObjectScope(JSEnvRec Parent, JSObject ScopeObject) : base(Parent) { this.ScopeObject = ScopeObject; }
protected internal virtual JSValue GetFunctionReference(int key, JSEnvRec r) { JSContext ctx = this; if (ctx.Source == null) { return this.Parent.GetFunctionReference(key, r); } functionExpressionNode fncNode = ctx.Source.FunctionList[key]; JSFunctionObject fnc = new JSFunctionObject(fncNode, r); fnc.SetDataProp("length", (double) fncNode.ParameterList.Names.Length, false, false, false); return fnc; }
public JSWithScope(JSEnvRec Parent, JSObject ScopeObject) : base(Parent, ScopeObject) { }
public JSGlobalScope(JSEnvRec Parent, JSObject ScopeObject) : base(Parent, ScopeObject) { }
public JSDeclScope(JSEnvRec Parent) : base(Parent) { this.scopeValues = new Dictionary <string, JSValue>(); }
public JSDeclScope(JSEnvRec Parent) : base(Parent) { this.scopeValues = new Dictionary<string, JSValue>(); }