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

Function getIntersectingMeaningFromDeclarations

test/fixtures/snapshot/typescript.js:138862–138884  ·  view source on GitHub ↗

* Given an initial searchMeaning, extracted from a location, widen the search scope based on the declarations * of the corresponding symbol. e.g. if we are searching for "Foo" in value position, but "Foo" references a class * then we need to widen the search to include type

(node, symbol)

Source from the content-addressed store, hash-verified

138860 * do not intersect in any of the three spaces.
138861 */
138862 function getIntersectingMeaningFromDeclarations(node, symbol) {
138863 var meaning = ts.getMeaningFromLocation(node);
138864 var declarations = symbol.declarations;
138865 if (declarations) {
138866 var lastIterationMeaning = void 0;
138867 do {
138868 // The result is order-sensitive, for instance if initialMeaning === Namespace, and declarations = [class, instantiated module]
138869 // we need to consider both as they initialMeaning intersects with the module in the namespace space, and the module
138870 // intersects with the class in the value space.
138871 // To achieve that we will keep iterating until the result stabilizes.
138872 // Remember the last meaning
138873 lastIterationMeaning = meaning;
138874 for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) {
138875 var declaration = declarations_2[_i];
138876 var declarationMeaning = ts.getMeaningFromDeclaration(declaration);
138877 if (declarationMeaning & meaning) {
138878 meaning |= declarationMeaning;
138879 }
138880 }
138881 } while (meaning !== lastIterationMeaning);
138882 }
138883 return meaning;
138884 }
138885 Core.getIntersectingMeaningFromDeclarations = getIntersectingMeaningFromDeclarations;
138886 function isImplementation(node) {
138887 return !!(node.flags & 16777216 /* NodeFlags.Ambient */) ? !(ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) :

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected