MCPcopy
hub / github.com/webpack/webpack / getAllReferences

Function getAllReferences

lib/util/concatenate.js:25–38  ·  view source on GitHub ↗
(variable)

Source from the content-addressed store, hash-verified

23 * @returns {Reference[]} references
24 */
25const getAllReferences = (variable) => {
26 let set = variable.references;
27 // Look for inner scope variables too (like in class Foo { t() { Foo } })
28 const identifiers = new Set(variable.identifiers);
29 for (const scope of variable.scope.childScopes) {
30 for (const innerVar of scope.variables) {
31 if (innerVar.identifiers.some((id) => identifiers.has(id))) {
32 set = [...set, ...innerVar.references];
33 break;
34 }
35 }
36 }
37 return set;
38};
39
40/**
41 * Returns result.

Callers 2

codeGenerationMethod · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected