function getIdentifierIfShouldBeConst(variable,ignoreReadBeforeAssign){if(variable.eslintUsed&&variable.scope.type==="global"){return null;}/*
     * Due to a bug in acorn, code such as `let foo = 1; let foo = 2;` will not throw a syntax error. As a sanity
     * check, make sure that the variable only has one declaration. After the parsing bug is fixed, this check
     * will no longer be necessary, because variables declared with `let` or `const` should always have exactly one
     * declaration.
     * https://github.com/ternjs/acorn/issues/487
     */if(variable.defs.length>1){return null;}// Finds the unique WriteReference.
var writer=null;var isReadBeforeInit=false;var references=variable.references;for(var i=0;i<references.length;++i){var reference=references[i];if(reference.isWrite()){var isReassigned=writer!==null&&writer.identifier!==reference.identifier;if(isReassigned){return null;}writer=reference;}else if(reference.isRead()&&writer===null){if(ignoreReadBeforeAssign){return null;}isReadBeforeInit=true;}}// If the assignment is from a different scope, ignore it.
// If the assignment cannot change to a declaration, ignore it.
var shouldBeConst=writer!==null&&writer.from===variable.scope&&canBecomeVariableDeclaration(writer.identifier);if(!shouldBeConst){return null;}if(isReadBeforeInit){return variable.defs[0].name;}return writer.identifier;}
Gets an identifier node of a given variable.

If the initialization exists or one or more reading references exist before
the first assignment, the identifier node is the node of the declaration.
Otherwise, the identifier node is the node of the first assignment.

If the variable should not change to const, this function returns null.
- If the variable is reassigned.
- If the variable is never initialized nor assigned.
- If the variable is initialized in a different scope from the declaration.
- If the unique assignment of the variable cannot change to a declaration.
  e.g. `if (a) b = 1` / `return (b = 1)`
- If the variable is declared in the global scope and `eslintUsed` is `true`.
  `/*exported foo` directive comment makes such variables. This rule does not
  warn such variables because this rule cannot distinguish whether the
  exported variables are reassigned or not.

@param {escope.Variable} variable - A variable to get.
@param {boolean} ignoreReadBeforeAssign -
     The value of `ignoreReadBeforeAssign` option.
@returns {ASTNode|null}
     An Identifier node if the variable should change to const.
     Otherwise, null.