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

Function isSymbolAccessibleWorker

test/fixtures/snapshot/typescript.js:52093–52121  ·  view source on GitHub ↗
(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible, allowModules)

Source from the content-addressed store, hash-verified

52091 return isSymbolAccessibleWorker(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible, /*allowModules*/ true);
52092 }
52093 function isSymbolAccessibleWorker(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible, allowModules) {
52094 if (symbol && enclosingDeclaration) {
52095 var result = isAnySymbolAccessible([symbol], enclosingDeclaration, symbol, meaning, shouldComputeAliasesToMakeVisible, allowModules);
52096 if (result) {
52097 return result;
52098 }
52099 // This could be a symbol that is not exported in the external module
52100 // or it could be a symbol from different external module that is not aliased and hence cannot be named
52101 var symbolExternalModule = ts.forEach(symbol.declarations, getExternalModuleContainer);
52102 if (symbolExternalModule) {
52103 var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration);
52104 if (symbolExternalModule !== enclosingExternalModule) {
52105 // name from different external module that is not visible
52106 return {
52107 accessibility: 2 /* SymbolAccessibility.CannotBeNamed */,
52108 errorSymbolName: symbolToString(symbol, enclosingDeclaration, meaning),
52109 errorModuleName: symbolToString(symbolExternalModule),
52110 errorNode: ts.isInJSFile(enclosingDeclaration) ? enclosingDeclaration : undefined,
52111 };
52112 }
52113 }
52114 // Just a local name that is not accessible
52115 return {
52116 accessibility: 1 /* SymbolAccessibility.NotAccessible */,
52117 errorSymbolName: symbolToString(symbol, enclosingDeclaration, meaning),
52118 };
52119 }
52120 return { accessibility: 0 /* SymbolAccessibility.Accessible */ };
52121 }
52122 function getExternalModuleContainer(declaration) {
52123 var node = ts.findAncestor(declaration, hasExternalModuleSymbol);
52124 return node && getSymbolOfNode(node);

Callers 4

isTypeSymbolAccessibleFunction · 0.85
isValueSymbolAccessibleFunction · 0.85
isSymbolAccessibleFunction · 0.85

Calls 4

isAnySymbolAccessibleFunction · 0.85
symbolToStringFunction · 0.85
forEachMethod · 0.65

Tested by

no test coverage detected