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

Function typeMemberIn

src/resolution/import-resolver.ts:3101–3111  ·  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

3099 * and an enum, a class or an interface takes the rest as its `::` members.
3100 */
3101function typeMemberIn(file: string, scope: string[], path: string[], context: ResolutionContext): Node | undefined {
3102 const [name, ...rest] = path;
3103 if (name === undefined) return undefined;
3104 if (rest.length > 0 && hasNamespace(file, [...scope, name].join('.'), context)) {
3105 return typeMemberIn(file, [...scope, name], rest, context);
3106 }
3107 const declared = declarationsIn(file, scope, name, context);
3108 if (rest.length === 0) return declared[0];
3109 const container = declared.find((n) => STATIC_MEMBER_CONTAINERS.has(n.kind));
3110 return container ? containerMember(container, rest, context) : undefined;
3111}
3112
3113/** An enum's, a class's or an interface's member at `path` (`Kind::Line`), in the container's own file. */
3114function containerMember(container: Node, path: string[], context: ResolutionContext): Node | undefined {

Callers 2

importedTypeMemberFunction · 0.85
ownTypeMemberFunction · 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