Given a variable declaration of some sort, check it's name and type and
if it looks like any of the key type changes between unsafe and atomic
queues, perform the conversion to change it's type.

@param node
@param name
346221
void processSpecialNodeTypes(NodeWithType<?, Type> node, String name) {
        Type type = node.getType();
        if ("buffer".equals(name) && isRefArray(type, "E")) {
            node.setType(atomicRefArrayType((ArrayType) type));
        } else if ("sBuffer".equals(name) && isLongArray(type)) {
            node.setType(atomicLongArrayType());
        } else if (PrimitiveType.longType().equals(type)) {
            switch(name) {
            case "mask":
            case "offset":
            case "seqOffset":
            case "lookAheadSeqOffset":
            case "lookAheadElementOffset":
                node.setType(PrimitiveType.intType());
            }
        }
    }
165969
private void addArcInitialization(EnumDeclaration node) {
    String enumClassName = nameTable.getFullName(node.getTypeElement());
    List<Statement> stmts = node.getClassInitStatements().subList(0, 0);
    int i = 0;
    for (EnumConstantDeclaration constant : node.getEnumConstants()) {
      VariableElement varElement = constant.getVariableElement();
      ClassInstanceCreation creation = new ClassInstanceCreation(constant.getExecutablePair());
      TreeUtil.copyList(constant.getArguments(), creation.getArguments());
      Expression constName = options.stripEnumConstants()
          ? new StringLiteral("JAVA_LANG_ENUM_NAME_STRIPPED", typeUtil)
          : new NativeExpression(
            UnicodeUtils.format("JreEnumConstantName(%s_class_(), %d)", enumClassName, i),
            typeUtil.getJavaString().asType());
      creation.addArgument(constName);
      creation.addArgument(new NumberLiteral(i++, typeUtil));
      creation.setHasRetainedResult(true);
      stmts.add(new ExpressionStatement(new Assignment(new SimpleName(varElement), creation)));
    }
  }
989372
Node createSingleConstNameDeclaration(String variableName, Node value) {
    return IR.constNode(createName(variableName, value.getJSType()), value);
  }
1041188
private boolean isTypeAnnotationAllowedForName(Node n) {
    checkState(n.isName(), n);
    // Only allow type annotations on nodes used as an lvalue.
    if (!NodeUtil.isLValue(n)) {
      return false;
    }
    // Don't allow JSDoc on a name in an assignment. Simple names should only have JSDoc on them
    // when originally declared.
    Node rootTarget = NodeUtil.getRootTarget(n);
    return !NodeUtil.isLhsOfAssign(rootTarget);
  }
51395
@Override
    public R visitVariable(VariableTree node, P p) {
        R r = scan(node.getModifiers(), p);
        r = scanAndReduce(node.getType(), p, r);
        r = scanAndReduce(node.getNameExpression(), p, r);
        r = scanAndReduce(node.getInitializer(), p, r);
        return r;
    }
1072940
protected void initDisplayName(XmlParser.Node node)
    {
        getWebApplicationContext().setDisplayName(node.toString(false,true));
    }
1158040
private JSType getVarNameType(Scope scope, String name) {
    Var var = scope.getVar(name);
    JSType type = null;
    if (var != null) {
      Node nameDefinitionNode = var.getNode();
      if (nameDefinitionNode != null) {
        type = nameDefinitionNode.getJSType();
      }
    }
    if (type == null) {
      // TODO(bradfordcsmith): Consider throwing an error if the type cannot be found.
      type = unknownType;
    }
    return type;
  }
594863
protected void isElementWellFormed(Node node) {
        boolean isNameWF = false;
        if ((fFeatures & NAMESPACES) != 0) {
            isNameWF =
                isValidQName(
                    node.getPrefix(),
                    node.getLocalName(),
                    fIsXMLVersion11);
        } else {
            isNameWF = isXMLName(node.getNodeName(), fIsXMLVersion11);
        }

        if (!isNameWF) {
            String msg =
                Utils.messages.createMessage(
                    MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
                    new Object[] { "Element", node.getNodeName()});

            if (fErrorHandler != null) {
                fErrorHandler.handleError(
                    new DOMErrorImpl(
                        DOMError.SEVERITY_FATAL_ERROR,
                        msg,
                        MsgKey.ER_WF_INVALID_CHARACTER_IN_NODE_NAME,
                        null,
                        null,
                        null));
            }
        }
    }
601505
function(name, nodes) {
          return (name === 'declaration' && nodes.content[0].content[0].type === 'variable') || (name === 'variable' && nodes.content[0].type === 'ident');
        }
534708
private void fixVariableDeclarations(SwitchStatement node) {
    List<Statement> statements = node.getStatements();
    Block block = new Block();
    List<Statement> blockStmts = block.getStatements();
    for (int i = 0; i < statements.size(); i++) {
      Statement stmt = statements.get(i);
      if (stmt instanceof VariableDeclarationStatement) {
        VariableDeclarationStatement declStmt = (VariableDeclarationStatement) stmt;
        statements.remove(i--);
        List<VariableDeclarationFragment> fragments = declStmt.getFragments();
        for (VariableDeclarationFragment decl : fragments) {
          Expression initializer = decl.getInitializer();
          if (initializer != null) {
            Assignment assignment = new Assignment(
                new SimpleName(decl.getVariableElement()), TreeUtil.remove(initializer));
            statements.add(++i, new ExpressionStatement(assignment));
          }
        }
        blockStmts.add(declStmt);
      }
    }
    if (blockStmts.size() > 0) {
      // There is at least one variable declaration, so copy this switch
      // statement into the new block and replace it in the parent list.
      node.replaceWith(block);
      blockStmts.add(node);
    }
  }
321663
public static final void serverShortName(String name)
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "serverShortName", name);

        _serverShortName = name;

        if (tc.isEntryEnabled())
            Tr.exit(tc, "serverShortName");
    }
965657
private void visitVar(NodeTraversal t, Node n) {
    // Handle var declarations in for-of loops separately from regular var declarations.
    if (n.getParent().isForOf() || n.getParent().isForIn()) {
      return;
    }

    // TODO(nicksantos): Fix this so that the doc info always shows up
    // on the NAME node. We probably want to wait for the parser
    // merge to fix this.
    JSDocInfo varInfo = n.hasOneChild() ? n.getJSDocInfo() : null;
    for (Node child : n.children()) {
      if (child.isName()) {
        Node value = child.getFirstChild();

        if (value != null) {
          JSType valueType = getJSType(value);
          JSDocInfo info = child.getJSDocInfo();
          if (info == null) {
            info = varInfo;
          }

          checkEnumAlias(t, info, valueType, value);
          checkCanAssignToWithScope(t, value, child, valueType, info, "initializing variable");
        }
      } else {
        checkState(child.isDestructuringLhs(), child);
        Node name = child.getFirstChild();
        Node value = child.getSecondChild();
        JSType valueType = getJSType(value);
        checkCanAssignToWithScope(
            t, child, name, valueType, /* info= */ null, "initializing variable");
      }
    }
  }
1029851
function(node, name) {
    this.acceptKey(node, name);

    if (!node[name]) {
      throw new Exception(node.type + ' requires ' + name);
    }
  }
656138
@Nullable
	public static Type evaluateJavaLangType(@Nonnull final String name) {
		Check.notEmpty(name, "name");
		Type ret = null;
		for (final Type type : JAVA_LANG_VALUE_TYPES) {
			if (type.getName().equals(name.replace("java.lang.", ""))) {
				ret = type;
				break;
			}
		}
		return ret;
	}
1223607
private void lookForVariableAccess(OptFunctionNode fn, Node n)
    {
        switch (n.getType()) {
            case Token.TYPEOFNAME:
            {
                // TYPEOFNAME may be used with undefined names, which is why
                // this is handled separately from GETVAR above.
                int varIndex = fn.fnode.getIndexForNameNode(n);
                if (varIndex > -1 && !itsNotDefSet.get(varIndex))
                    itsUseBeforeDefSet.set(varIndex);
            }
            break;
            case Token.DEC :
            case Token.INC :
            {
                Node child = n.getFirstChild();
                if (child.getType() == Token.GETVAR) {
                    int varIndex = fn.getVarIndex(child);
                    if (!itsNotDefSet.get(varIndex))
                        itsUseBeforeDefSet.set(varIndex);
                    itsNotDefSet.set(varIndex);
                } else {
                    lookForVariableAccess(fn, child);
                }
            }
            break;
            case Token.SETVAR :
            case Token.SETCONSTVAR :
            {
                Node lhs = n.getFirstChild();
                Node rhs = lhs.getNext();
                lookForVariableAccess(fn, rhs);
                itsNotDefSet.set(fn.getVarIndex(n));
            }
            break;
            case Token.GETVAR :
            {
                int varIndex = fn.getVarIndex(n);
                if (!itsNotDefSet.get(varIndex))
                    itsUseBeforeDefSet.set(varIndex);
            }
            break;
            default :
                Node child = n.getFirstChild();
                while (child != null) {
                    lookForVariableAccess(fn, child);
                    child = child.getNext();
                }
                break;
        }
    }
317783
public void declarePrototypeProperty(String name, JSType type, Node defSite) {
    prototype.defineDeclaredProperty(name, type, defSite);
  }
153536
public void tload(String name) throws IOException
    {
        TypeMirror cn = getLocalType(name);
        int index = getLocalVariableIndex(name);
        if (Typ.isPrimitive(cn))
        {
            super.tload(cn, index);
        }
        else
        {
            super.aload(index);
        }
    }