MCPcopy Index your code
hub / github.com/nodejs/node / serializeSymbol

Function serializeSymbol

test/fixtures/snapshot/typescript.js:54320–54340  ·  view source on GitHub ↗
(symbol, isPrivate, propertyAsAlias)

Source from the content-addressed store, hash-verified

54318 }
54319 }
54320 function serializeSymbol(symbol, isPrivate, propertyAsAlias) {
54321 // cache visited list based on merged symbol, since we want to use the unmerged top-level symbol, but
54322 // still skip reserializing it if we encounter the merged product later on
54323 var visitedSym = getMergedSymbol(symbol);
54324 if (visitedSymbols.has(getSymbolId(visitedSym))) {
54325 return; // Already printed
54326 }
54327 visitedSymbols.add(getSymbolId(visitedSym));
54328 // Only actually serialize symbols within the correct enclosing declaration, otherwise do nothing with the out-of-context symbol
54329 var skipMembershipCheck = !isPrivate; // We only call this on exported symbols when we know they're in the correct scope
54330 if (skipMembershipCheck || (!!ts.length(symbol.declarations) && ts.some(symbol.declarations, function (d) { return !!ts.findAncestor(d, function (n) { return n === enclosingDeclaration; }); }))) {
54331 var oldContext = context;
54332 context = cloneNodeBuilderContext(context);
54333 var result = serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
54334 if (context.reportedDiagnostic) {
54335 oldcontext.reportedDiagnostic = context.reportedDiagnostic; // hoist diagnostic result into outer context
54336 }
54337 context = oldContext;
54338 return result;
54339 }
54340 }
54341 // Synthesize declarations for a symbol - might be an Interface, a Class, a Namespace, a Type, a Variable (const, let, or var), an Alias
54342 // or a merge of some number of those.
54343 // An interesting challenge is ensuring that when classes merge with namespaces and interfaces, is keeping

Callers 1

visitSymbolTableFunction · 0.85

Calls 8

getMergedSymbolFunction · 0.85
getSymbolIdFunction · 0.85
cloneNodeBuilderContextFunction · 0.85
serializeSymbolWorkerFunction · 0.85
someMethod · 0.80
hasMethod · 0.65
addMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…