function isLocalVariableWithoutEscape(expression, surroundingFunction) {
            if (expression.type !== "Identifier") {
                return false;
            }

            const variable = resolveVariable(expression);

            if (!variable) {
                return false;
            }

            return variable.references.every(reference => identifierToSurroundingFunctionMap.get(reference.identifier) === surroundingFunction) &&
                variable.defs.every(def => identifierToSurroundingFunctionMap.get(def.name) === surroundingFunction);
        }
function isLocalVariableWithoutEscape(expression, surroundingFunction) {
            if (expression.type !== "Identifier") {
                return false;
            }

            const variable = resolveVariable(expression);

            if (!variable) {
                return false;
            }

            return variable.references.every(reference => identifierToSurroundingFunctionMap.get(reference.identifier) === surroundingFunction) &&
                variable.defs.every(def => identifierToSurroundingFunctionMap.get(def.name) === surroundingFunction);
        }
function isLocalVariableWithoutEscape ( expression , surroundingFunction ) { if ( expression . type !== "Identifier" ) { return false ; } const variable = resolveVariable ( expression ) ; if ( ! variable ) { return false ; } return variable . references . every ( reference => identifierToSurroundingFunctionMap . get ( reference . identifier ) === surroundingFunction ) && variable . defs . every ( def => identifierToSurroundingFunctionMap . get ( def . name ) === surroundingFunction ) ; }
Checks if an expression is a variable that can only be observed within the given function.
@param {ASTNode} expression The expression to check
@param {ASTNode} surroundingFunction The function node
@returns {boolean} `true` if the expression is a variable which is local to the given function, and is never
referenced in a closure.
Checks if an expression is a variable that can only be observed within the given function .
Check if expression is local variable without escaping