public virtual void InitScopeVars(AstScope parentScope) { Variables = new Dictionary <string, SymbolDef>(); Functions = new Dictionary <string, SymbolDef>(); UsesWith = false; UsesEval = false; ParentScope = parentScope; Enclosed = new StructList <SymbolDef>(); Cname = 0; }
public override void InitScopeVars(AstScope parentScope) { base.InitScopeVars(parentScope); UsesArguments = false; // Arrow functions cannot use arguments if (!(this is AstArrow)) { DefVariable(new AstSymbolFunarg(Start, End, "arguments"), null); } }
public static bool IsParentScopeFor(this AstScope parentScope, AstScope?potentiallyNestedScope) { var scope = potentiallyNestedScope; while (scope != null) { if (scope == parentScope) { return(true); } scope = scope.ParentScope; } return(false); }