…lines 1–252 unchanged (252 lines)
253 private final List<AliasUsage> aliasUsages = Lists.newArrayList();
254
255 // This map is temporary and cleared for each scope.
256 private final Map<String, Var> aliases = Maps.newHashMap();
257
258 // Also temporary and cleared for each scope.
259 private final Set<Node> injectedDecls = Sets.newHashSet();
260
261 // Suppose you create an alias.
262 // var x = goog.x;
263 // As a side-effect, this means you can shadow the namespace 'goog'
264 // in inner scopes. When we inline the namespaces, we have to rename
265 // these shadows.
…lines 266–310 unchanged (45 lines)
311 if (t.getScopeDepth() > 2) {
312 findNamespaceShadows(t);
313 }
314
315 if (t.getScopeDepth() == 2) {
316 renameNamespaceShadows(t);
317 injectedDecls.clear();
318 aliases.clear();
319 forbiddenLocals.clear();
320 transformation = null;
321 hasNamespaceShadows = false;
322 }
323 }
…lines 324–427 unchanged (104 lines)
428
429 if (isHoisted) {
430 grandparent.addChildToFront(newDecl);
431 } else {
432 grandparent.addChildBefore(newDecl, varNode);
433 }
434 injectedDecls.add(newDecl.getFirstChild());
435 }
436
437 // Rewrite "var name = EXPR;" to "var name = $jscomp.scope.name;"
438 v.getNameNode().addChildToFront(
439 NodeUtil.newQualifiedNameNode(
440 compiler.getCodingConvention(), globalName, n, name));
…lines 441–577 unchanged (137 lines)
578 aliasUsages.add(new AliasedNode(aliasVar, n));
579 }
580
581 // When we inject declarations, we duplicate jsdoc. Make sure
582 // we only process that jsdoc once.
583 JSDocInfo info = n.getJSDocInfo();
584 if (info != null && !injectedDecls.contains(n)) {
585 for (Node node : info.getTypeNodes()) {
586 fixTypeNode(node);
587 }
588 }
589
590 // TODO(robbyw): Error for goog.scope not at root.
591 }
592 }
593
594 private void fixTypeNode(Node typeNode) {
…lines 595–615 unchanged (21 lines)