public static JsStatement Process(JsStatement statement) { var locals = LocalVariableGatherer.Analyze(statement); var globals = ImplicitGlobalsGatherer.Analyze(statement, locals, reportGlobalsAsUsedInAllParentScopes: true); var renames = IdentifierRenameMapBuilder.Analyze(statement, locals, globals, GenerateName); return(IdentifierRenamer.Process(statement, renames)); }
public static IDictionary <JsDeclarationScope, IDictionary <string, string> > Analyze(JsStatement statement, Dictionary <JsDeclarationScope, HashSet <string> > locals, Dictionary <JsDeclarationScope, HashSet <string> > globals, Func <string, HashSet <string>, string> generateName) { var obj = new IdentifierRenameMapBuilder(locals, globals, generateName); var rootMap = obj.BuildMap(null, JsDeclarationScope.Root); obj._result[JsDeclarationScope.Root] = rootMap.Item1; obj.VisitStatement(statement, rootMap); return(obj._result); }