code: private void flattenPrefixes(String alias, Name n, int depth) {
      // Only flatten the prefix of a name declaration if the name being
      // initialized is fully qualified (i.e. not an object literal key).
      String originalName = n.getFullName();
      Ref decl = n.getDeclaration();
      if (decl != null && decl.getNode() != null && decl.getNode().isGetProp()) {
        flattenNameRefAtDepth(alias, decl.getNode(), depth, originalName);
      }
  
      for (Ref r : n.getRefs()) {
        if (r == decl) {
          // Declarations are handled separately.
          continue;
        }
  
        // References inside a complex assign (a = x.y = 0)
        // have twins. We should only flatten one of the twins.
        if (r.getTwin() == null || r.isSet()) {
          flattenNameRefAtDepth(alias, r.getNode(), depth, originalName);
        }
      }
  
      if (n.props != null) {
        for (Name p : n.props) {
          flattenPrefixes(alias, p, depth + 1);
        }
      }
    }
docs: Flattens all occurrences of a name as a prefix of subnames beginning
  with a particular subname.
  
  @param n A global property name (e.g. "a.b.c.d")
  @param alias A flattened prefix name (e.g. "a$b")
  @param depth The difference in depth between the property name and
  the prefix name (e.g. 2)