public static HoistingScope GetProgramLevelDeclarations( Program script, bool collectVarNames = false, bool collectLexicalNames = false) { var treeWalker = new ScriptWalker(StrictModeScope.IsStrictModeCode, collectVarNames, collectLexicalNames); treeWalker.Visit(script, null); return(new HoistingScope( treeWalker._functions, treeWalker._varNames, treeWalker._variableDeclarations, treeWalker._lexicalDeclarations, treeWalker._lexicalNames)); }
public static HoistingScope GetModuleLevelDeclarations( Module module, bool collectVarNames = false, bool collectLexicalNames = false) { //Modules area always strict var treeWalker = new ScriptWalker(true, collectVarNames, collectLexicalNames); treeWalker.Visit(module, null); return(new HoistingScope( treeWalker._functions, treeWalker._varNames, treeWalker._variableDeclarations, treeWalker._lexicalDeclarations, treeWalker._lexicalNames)); }
public void VisitChildren() { var walker = new ScriptWalker(); walker.Visit(_script); if (walker._lexicalNameCount != 0) { throw new InvalidOperationException("wrong _lexicalNameCount" + walker._lexicalNameCount); } if (walker._varNameCount != 1856) { throw new InvalidOperationException("wrong _varNameCount " + walker._varNameCount); } if (walker._functionCount != 1610) { throw new InvalidOperationException("wrong _functionCount " + walker._functionCount); } }