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

Function getPropertySymbolsFromBaseTypes

test/fixtures/snapshot/typescript.js:138810–138827  ·  view source on GitHub ↗

* Find symbol of the given property-name and add the symbol to the given result array * @param symbol a symbol to start searching for the given propertyName * @param propertyName a name of property to search for * @param result an array of symbol of found prope

(symbol, propertyName, checker, cb)

Source from the content-addressed store, hash-verified

138808 * The value of previousIterationSymbol is undefined when the function is first called.
138809 */
138810 function getPropertySymbolsFromBaseTypes(symbol, propertyName, checker, cb) {
138811 var seen = new ts.Map();
138812 return recur(symbol);
138813 function recur(symbol) {
138814 // Use `addToSeen` to ensure we don't infinitely recurse in this situation:
138815 // interface C extends C {
138816 // /*findRef*/propName: string;
138817 // }
138818 if (!(symbol.flags & (32 /* SymbolFlags.Class */ | 64 /* SymbolFlags.Interface */)) || !ts.addToSeen(seen, ts.getSymbolId(symbol)))
138819 return;
138820 return ts.firstDefined(symbol.declarations, function (declaration) { return ts.firstDefined(ts.getAllSuperTypeNodes(declaration), function (typeReference) {
138821 var type = checker.getTypeAtLocation(typeReference);
138822 var propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName);
138823 // Visit the typeReference as well to see if it directly or indirectly uses that property
138824 return type && propertySymbol && (ts.firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol));
138825 }); });
138826 }
138827 }
138828 function isStaticSymbol(symbol) {
138829 if (!symbol.valueDeclaration)
138830 return false;

Callers 1

fromRootFunction · 0.85

Calls 1

recurFunction · 0.85

Tested by

no test coverage detected