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

Function isEntityNameVisible

test/fixtures/snapshot/typescript.js:52183–52213  ·  view source on GitHub ↗
(entityName, enclosingDeclaration)

Source from the content-addressed store, hash-verified

52181 }
52182 }
52183 function isEntityNameVisible(entityName, enclosingDeclaration) {
52184 // get symbol of the first identifier of the entityName
52185 var meaning;
52186 if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ ||
52187 entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) ||
52188 entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) {
52189 // Typeof value
52190 meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */;
52191 }
52192 else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ||
52193 entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) {
52194 // Left identifier from type reference or TypeAlias
52195 // Entity name of the import declaration
52196 meaning = 1920 /* SymbolFlags.Namespace */;
52197 }
52198 else {
52199 // Type Reference or TypeAlias entity = Identifier
52200 meaning = 788968 /* SymbolFlags.Type */;
52201 }
52202 var firstIdentifier = ts.getFirstIdentifier(entityName);
52203 var symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
52204 if (symbol && symbol.flags & 262144 /* SymbolFlags.TypeParameter */ && meaning & 788968 /* SymbolFlags.Type */) {
52205 return { accessibility: 0 /* SymbolAccessibility.Accessible */ };
52206 }
52207 // Verify if the symbol is accessible
52208 return (symbol && hasVisibleDeclarations(symbol, /*shouldComputeAliasToMakeVisible*/ true)) || {
52209 accessibility: 1 /* SymbolAccessibility.NotAccessible */,
52210 errorSymbolName: ts.getTextOfNode(firstIdentifier),
52211 errorNode: firstIdentifier
52212 };
52213 }
52214 function symbolToString(symbol, enclosingDeclaration, meaning, flags, writer) {
52215 if (flags === void 0) { flags = 4 /* SymbolFormatFlags.AllowAnyNodeKind */; }
52216 var nodeFlags = 70221824 /* NodeBuilderFlags.IgnoreErrors */;

Callers

nothing calls this directly

Calls 2

resolveNameFunction · 0.85
hasVisibleDeclarationsFunction · 0.85

Tested by

no test coverage detected