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

Function typeMemberIn

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

* What `path` names in `file`, from the namespace `scope` (the file's top * level when empty): a namespace takes the next name as a member of its own, * and an enum, a class or an interface takes the rest as its `::` members.

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

Source from the content-addressed store, hash-verified

3200 * and an enum, a class or an interface takes the rest as its `::` members.
3201 */
3202function typeMemberIn(file: string, scope: string[], path: string[], context: ResolutionContext): Node | undefined {
3203 const [name, ...rest] = path;
3204 if (name === undefined) return undefined;
3205 if (rest.length > 0 && hasNamespace(file, [...scope, name].join('.'), context)) {
3206 return typeMemberIn(file, [...scope, name], rest, context);
3207 }
3208 const declared = declarationsIn(file, scope, name, context);
3209 if (rest.length === 0) return declared[0];
3210 const container = declared.find((n) => STATIC_MEMBER_CONTAINERS.has(n.kind));
3211 return container ? containerMember(container, rest, context) : undefined;
3212}
3213
3214/** An enum's, a class's or an interface's member at `path` (`Kind::Line`), in the container's own file. */
3215function containerMember(container: Node, path: string[], context: ResolutionContext): Node | undefined {

Callers 3

importedTypeMemberFunction · 0.85
ownTypeMemberFunction · 0.85
resolveViaImportFunction · 0.85

Calls 5

hasNamespaceFunction · 0.85
declarationsInFunction · 0.85
containerMemberFunction · 0.85
hasMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected