mirror of
https://github.com/morluto/rea
synced 2026-10-25 22:08:11 -04:00
13 lines
375 B
JavaScript
13 lines
375 B
JavaScript
/** Resolve the lexical binding instead of treating a matching name as an API. */
|
|
export const findBinding = (sourceCode, identifier) => {
|
|
for (
|
|
let scope = sourceCode.getScope(identifier);
|
|
scope !== null;
|
|
scope = scope.upper
|
|
) {
|
|
const variable = scope.set.get(identifier.name);
|
|
if (variable !== undefined) return variable;
|
|
}
|
|
return undefined;
|
|
};
|