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

Function visitDeclarationSubtree

test/fixtures/snapshot/typescript.js:108744–108926  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

108742 }
108743 }
108744 function visitDeclarationSubtree(input) {
108745 if (shouldStripInternal(input))
108746 return;
108747 if (ts.isDeclaration(input)) {
108748 if (isDeclarationAndNotVisible(input))
108749 return;
108750 if (ts.hasDynamicName(input) && !resolver.isLateBound(ts.getParseTreeNode(input))) {
108751 return;
108752 }
108753 }
108754 // Elide implementation signatures from overload sets
108755 if (ts.isFunctionLike(input) && resolver.isImplementationOfOverload(input))
108756 return;
108757 // Elide semicolon class statements
108758 if (ts.isSemicolonClassElement(input))
108759 return;
108760 var previousEnclosingDeclaration;
108761 if (isEnclosingDeclaration(input)) {
108762 previousEnclosingDeclaration = enclosingDeclaration;
108763 enclosingDeclaration = input;
108764 }
108765 var oldDiag = getSymbolAccessibilityDiagnostic;
108766 // Setup diagnostic-related flags before first potential `cleanup` call, otherwise
108767 // We'd see a TDZ violation at runtime
108768 var canProduceDiagnostic = ts.canProduceDiagnostics(input);
108769 var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
108770 var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */);
108771 // Emit methods which are private as properties with no type information
108772 if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) {
108773 if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) {
108774 if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input)
108775 return; // Elide all but the first overload
108776 return cleanup(factory.createPropertyDeclaration(/*decorators*/ undefined, ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined));
108777 }
108778 }
108779 if (canProduceDiagnostic && !suppressNewDiagnosticContexts) {
108780 getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(input);
108781 }
108782 if (ts.isTypeQueryNode(input)) {
108783 checkEntityNameVisibility(input.exprName, enclosingDeclaration);
108784 }
108785 if (shouldEnterSuppressNewDiagnosticsContextContext) {
108786 // We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
108787 suppressNewDiagnosticContexts = true;
108788 }
108789 if (isProcessedComponent(input)) {
108790 switch (input.kind) {
108791 case 228 /* SyntaxKind.ExpressionWithTypeArguments */: {
108792 if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) {
108793 checkEntityNameVisibility(input.expression, enclosingDeclaration);
108794 }
108795 var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
108796 return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments));
108797 }
108798 case 178 /* SyntaxKind.TypeReference */: {
108799 checkEntityNameVisibility(input.typeName, enclosingDeclaration);
108800 var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
108801 return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments));

Callers

nothing calls this directly

Calls 15

shouldStripInternalFunction · 0.85
isEnclosingDeclarationFunction · 0.85
ensureModifiersFunction · 0.85
isProcessedComponentFunction · 0.85
ensureTypeParamsFunction · 0.85
updateParamsListFunction · 0.85
ensureTypeFunction · 0.85
updateAccessorParamsListFunction · 0.85
ensureNoInitializerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…