MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / declarationsIn

Function declarationsIn

src/resolution/import-resolver.ts:3486–3492  ·  view source on GitHub ↗

The declarations named `name` directly in the namespace `scope` of `file` (its top level when empty), types first.

(file: string, scope: string[], name: string, context: ResolutionContext)

Source from the content-addressed store, hash-verified

3484
3485/** The declarations named `name` directly in the namespace `scope` of `file` (its top level when empty), types first. */
3486function declarationsIn(file: string, scope: string[], name: string, context: ResolutionContext): Node[] {
3487 const blocks = namespaceBlocks(file, context);
3488 const want = scope.join('.');
3489 return (context.getNodesInFileNamed?.(file, name) ?? nodesNamed(context, file, name).filter((n) => n.name === name))
3490 .filter((n) => n.qualifiedName === name && MEMBER_DECLARATION_KINDS.has(n.kind) && (innermostBlock(n, blocks)?.path ?? '') === want)
3491 .sort(typesFirst);
3492}
3493
3494/** Whether `file` declares the namespace `path`, itself or as the prefix of a longer one (`namespace A.B` declares `A`). */
3495function hasNamespace(file: string, path: string, context: ResolutionContext): boolean {

Callers 2

ownTypeMemberFunction · 0.85
typeMemberInFunction · 0.85

Calls 6

namespaceBlocksFunction · 0.90
nodesNamedFunction · 0.90
innermostBlockFunction · 0.85
getNodesInFileNamedMethod · 0.80
hasMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected