MCPcopy Create free account
hub / github.com/nodejs/node / isExportsOrModuleExportsOrAlias

Function isExportsOrModuleExportsOrAlias

test/fixtures/snapshot/typescript.js:47749–47771  ·  view source on GitHub ↗
(sourceFile, node)

Source from the content-addressed store, hash-verified

47747 }
47748 }
47749 function isExportsOrModuleExportsOrAlias(sourceFile, node) {
47750 var i = 0;
47751 var q = [node];
47752 while (q.length && i < 100) {
47753 i++;
47754 node = q.shift();
47755 if (ts.isExportsIdentifier(node) || ts.isModuleExportsAccessExpression(node)) {
47756 return true;
47757 }
47758 else if (ts.isIdentifier(node)) {
47759 var symbol = lookupSymbolForName(sourceFile, node.escapedText);
47760 if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
47761 var init = symbol.valueDeclaration.initializer;
47762 q.push(init);
47763 if (ts.isAssignmentExpression(init, /*excludeCompoundAssignment*/ true)) {
47764 q.push(init.left);
47765 q.push(init.right);
47766 }
47767 }
47768 }
47769 }
47770 return false;
47771 }
47772 ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
47773 function lookupSymbolForName(container, name) {
47774 var local = container.locals && container.locals.get(name);

Calls 3

lookupSymbolForNameFunction · 0.85
shiftMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected