MCPcopy Create free account
hub / github.com/rollup/plugins / addDeclaration

Method addDeclaration

packages/pluginutils/src/attachScopes.ts:44–54  ·  view source on GitHub ↗
(node: estree.Node, isBlockDeclaration: boolean, isVar: boolean)

Source from the content-addressed store, hash-verified

42 }
43
44 addDeclaration(node: estree.Node, isBlockDeclaration: boolean, isVar: boolean): void {
45 if (!isBlockDeclaration && this.isBlockScope) {
46 // it's a `var` or function node, and this
47 // is a block scope, so we need to go up
48 this.parent!.addDeclaration(node, isBlockDeclaration, isVar);
49 } else if ((node as any).id) {
50 extractAssignedNames((node as any).id).forEach((name) => {
51 this.declarations[name] = true;
52 });
53 }
54 }
55
56 contains(name: string): boolean {
57 return this.declarations[name] || (this.parent ? this.parent.contains(name) : false);

Callers

nothing calls this directly

Calls 2

extractAssignedNamesFunction · 0.85
addDeclarationMethod · 0.65

Tested by

no test coverage detected