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

Function declareSymbolAndAddToSymbolTable

test/fixtures/snapshot/typescript.js:46277–46331  ·  view source on GitHub ↗
(node, symbolFlags, symbolExcludes)

Source from the content-addressed store, hash-verified

46275 lastContainer = next;
46276 }
46277 function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
46278 switch (container.kind) {
46279 // Modules, source files, and classes need specialized handling for how their
46280 // members are declared (for example, a member of a class will go into a specific
46281 // symbol table depending on if it is static or not). We defer to specialized
46282 // handlers to take care of declaring these child members.
46283 case 261 /* SyntaxKind.ModuleDeclaration */:
46284 return declareModuleMember(node, symbolFlags, symbolExcludes);
46285 case 305 /* SyntaxKind.SourceFile */:
46286 return declareSourceFileMember(node, symbolFlags, symbolExcludes);
46287 case 226 /* SyntaxKind.ClassExpression */:
46288 case 257 /* SyntaxKind.ClassDeclaration */:
46289 return declareClassMember(node, symbolFlags, symbolExcludes);
46290 case 260 /* SyntaxKind.EnumDeclaration */:
46291 return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
46292 case 182 /* SyntaxKind.TypeLiteral */:
46293 case 322 /* SyntaxKind.JSDocTypeLiteral */:
46294 case 205 /* SyntaxKind.ObjectLiteralExpression */:
46295 case 258 /* SyntaxKind.InterfaceDeclaration */:
46296 case 286 /* SyntaxKind.JsxAttributes */:
46297 // Interface/Object-types always have their children added to the 'members' of
46298 // their container. They are only accessible through an instance of their
46299 // container, and are never in scope otherwise (even inside the body of the
46300 // object / type / interface declaring them). An exception is type parameters,
46301 // which are in scope without qualification (similar to 'locals').
46302 return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
46303 case 179 /* SyntaxKind.FunctionType */:
46304 case 180 /* SyntaxKind.ConstructorType */:
46305 case 174 /* SyntaxKind.CallSignature */:
46306 case 175 /* SyntaxKind.ConstructSignature */:
46307 case 323 /* SyntaxKind.JSDocSignature */:
46308 case 176 /* SyntaxKind.IndexSignature */:
46309 case 169 /* SyntaxKind.MethodDeclaration */:
46310 case 168 /* SyntaxKind.MethodSignature */:
46311 case 171 /* SyntaxKind.Constructor */:
46312 case 172 /* SyntaxKind.GetAccessor */:
46313 case 173 /* SyntaxKind.SetAccessor */:
46314 case 256 /* SyntaxKind.FunctionDeclaration */:
46315 case 213 /* SyntaxKind.FunctionExpression */:
46316 case 214 /* SyntaxKind.ArrowFunction */:
46317 case 317 /* SyntaxKind.JSDocFunctionType */:
46318 case 345 /* SyntaxKind.JSDocTypedefTag */:
46319 case 338 /* SyntaxKind.JSDocCallbackTag */:
46320 case 170 /* SyntaxKind.ClassStaticBlockDeclaration */:
46321 case 259 /* SyntaxKind.TypeAliasDeclaration */:
46322 case 195 /* SyntaxKind.MappedType */:
46323 // All the children of these container types are never visible through another
46324 // symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
46325 // they're only accessed 'lexically' (i.e. from code that exists underneath
46326 // their container in the tree). To accomplish this, we simply add their declared
46327 // symbol to the 'locals' of the container. These symbols can then be found as
46328 // the type checker walks up the containers, checking them for matching names.
46329 return declareSymbol(container.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes);
46330 }
46331 }
46332 function declareClassMember(node, symbolFlags, symbolExcludes) {
46333 return ts.isStatic(node)
46334 ? declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes)

Callers 11

bindModuleDeclarationFunction · 0.85
declareModuleSymbolFunction · 0.85
bindJsxAttributeFunction · 0.85
bindWorkerFunction · 0.85
bindImportClauseFunction · 0.85
bindParameterFunction · 0.85
bindFunctionDeclarationFunction · 0.85
bindTypeParameterFunction · 0.85

Calls 4

declareModuleMemberFunction · 0.85
declareSourceFileMemberFunction · 0.85
declareClassMemberFunction · 0.85
declareSymbolFunction · 0.85

Tested by

no test coverage detected