 -      Scope scope = t.getScope();
 -      for (Var v : scope.getVarIterable()) {
 -        Node n = v.getNode();
-+    @Override
-+    public void visit(NodeTraversal t, Node n, Node parent) {
-+      if (isCallToScopeMethod(n)) {
-+        if (preprocessorSymbolTable != null) {
-+          preprocessorSymbolTable.addReference(n.getFirstChild());
-+        }
-+        if (!NodeUtil.isExpressionNode(parent)) {
-+          report(t, n, GOOG_SCOPE_USED_IMPROPERLY);
-+        }
-+        if (n.getChildCount() != 2) {
-+          report(t, n, GOOG_SCOPE_HAS_BAD_PARAMETERS);
-+        } else {
-+          Node anonymousFnNode = n.getChildAtIndex(1);
-+          if (!NodeUtil.isFunction(anonymousFnNode) ||
-+              NodeUtil.getFunctionName(anonymousFnNode) != null ||
-+              NodeUtil.getFunctionParameters(anonymousFnNode).hasChildren()) {
-+            report(t, anonymousFnNode, GOOG_SCOPE_HAS_BAD_PARAMETERS);
-+          } else {
-+            scopeCalls.add(n);
-+          }
-+        }
-+      }
-+
-+
-+      if (t.getScopeDepth() == 2) {
-         int type = n.getType();
+-        int type = n.getType();
 -        Node parent = n.getParent();
 -        if (parent.getType() == Token.VAR) {
-+        if (type == Token.NAME && parent.getType() == Token.VAR) {
-           if (n.hasChildren() && n.getFirstChild().isQualifiedName()) {
-             String name = n.getString();
+-          if (n.hasChildren() && n.getFirstChild().isQualifiedName()) {
+-            String name = n.getString();
 -            Var aliasVar = scope.getVar(name);
-+            Var aliasVar = t.getScope().getVar(name);
-             aliases.put(name, aliasVar);
+-            aliases.put(name, aliasVar);
  
-+            aliasDefinitions.add(n);
-             String qualifiedName =
-                 aliasVar.getInitialValue().getQualifiedName();
-             transformation.addAlias(name, qualifiedName);
-+            return;
-           } else {
+-            String qualifiedName =
+-                aliasVar.getInitialValue().getQualifiedName();
+-            transformation.addAlias(name, qualifiedName);
+-          } else {
              // TODO(robbyw): Support using locals for private variables.
-             report(t, n, GOOG_SCOPE_NON_ALIAS_LOCAL, n.getString());
-           }
-         }
--      }
--    }
- 
--    private void validateScopeCall(NodeTraversal t, Node n, Node parent) {
--      if (preprocessorSymbolTable != null) {
--        preprocessorSymbolTable.addReference(n.getFirstChild());
--      }
--      if (!NodeUtil.isExpressionNode(parent)) {
--        report(t, n, GOOG_SCOPE_USED_IMPROPERLY);
--      }
--      if (n.getChildCount() != 2) {
-         // The goog.scope call should have exactly 1 parameter.  The first
-         // child is the "goog.scope" and the second should be the parameter.
--        report(t, n, GOOG_SCOPE_HAS_BAD_PARAMETERS);
--      } else {
--        Node anonymousFnNode = n.getChildAtIndex(1);
--        if (!NodeUtil.isFunction(anonymousFnNode) ||
--            NodeUtil.getFunctionName(anonymousFnNode) != null ||
--            NodeUtil.getFunctionParameters(anonymousFnNode).hasChildren()) {
--          report(t, anonymousFnNode, GOOG_SCOPE_HAS_BAD_PARAMETERS);
--        } else {
--          scopeCalls.add(n);
+-            report(t, n, GOOG_SCOPE_NON_ALIAS_LOCAL, n.getString());
+-          }
 -        }
 -      }
 -    }
  
--    @Override
--    public void visit(NodeTraversal t, Node n, Node parent) {
--      if (isCallToScopeMethod(n)) {
--        validateScopeCall(t, n, n.getParent());
--      }
+     private void validateScopeCall(NodeTraversal t, Node n, Node parent) {
+       if (preprocessorSymbolTable != null) {
+@@ -321,33 +300,32 @@ class ScopedAliases implements HotSwapCompilerPass {
+         validateScopeCall(t, n, n.getParent());
+       }
  
 -      if (t.getScopeDepth() < 2) {
 -        return;

-      }
 
       // Validate the top level of the goog.scope block.
-      if (t.getScopeDepth() == 2) {
-        if (aliasVar != null && NodeUtil.isLValue(n)) {
-          if (aliasVar.getNode() == n) {
-            aliasDefinitionsInOrder.add(n);
 
             // Return early, to ensure that we don't record a definition
             // twice.
-            return;
-          } else {
-            report(t, n, GOOG_SCOPE_ALIAS_REDEFINED, n.getString());
-          }
+        if (type == Token.NAME && NodeUtil.isAssignmentOp(parent) &&
+            n == parent.getFirstChild()) {
+          report(t, n, GOOG_SCOPE_ALIAS_REDEFINED, n.getString());
         }
 
         if (type == Token.RETURN) {
@@ -361,7 +338,12 @@ class ScopedAliases implements HotSwapCompilerPass {
       // Validate all descendent scopes of the goog.scope block.
       if (t.getScopeDepth() >= 2) {
         // Check if this name points to an alias.

+        if (n.getType() == Token.NAME) {
+          String name = n.getString();
+          Var aliasVar = aliases.get(name);
+          if (aliasVar != null &&
+              t.getScope().getVar(name) == aliasVar) {
           // Note, to support the transitive case, it's important we don't
