code: private void addStubsForUndeclaredProperties(Name n, String alias, Node parent, Node addAfter) {
      checkState(n.canCollapseUnannotatedChildNames(), n);
      checkArgument(NodeUtil.isStatementBlock(parent), parent);
      checkNotNull(addAfter);
      if (n.props == null) {
        return;
      }
      for (Name p : n.props) {
        if (p.needsToBeStubbed()) {
          String propAlias = appendPropForAlias(alias, p.getBaseName());
          Node nameNode = IR.name(propAlias);
          Node newVar = IR.var(nameNode).useSourceInfoIfMissingFromForTree(addAfter);
          parent.addChildAfter(newVar, addAfter);
          addAfter = newVar;
          compiler.reportChangeToEnclosingScope(newVar);
          // Determine if this is a constant var by checking the first
          // reference to it. Don't check the declaration, as it might be null.
          if (p.getFirstRef().getNode().getLastChild().getBooleanProp(Node.IS_CONSTANT_NAME)) {
            nameNode.putBooleanProp(Node.IS_CONSTANT_NAME, true);
            compiler.reportChangeToEnclosingScope(nameNode);
          }
        }
      }
    }
docs: Adds global variable "stubs" for any properties of a global name that are only set in a local
  scope or read but never set.
  
  @param n An object representing a global name (e.g. "a", "a.b.c")
  @param alias The flattened name of the object whose properties we are adding stubs for (e.g.
  "a$b$c")
  @param parent The node to which new global variables should be added as children
  @param addAfter The child of after which new variables should be added