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

Function valueOfDeclaration

src/resolution/pascal-scope.ts:1611–1615  ·  view source on GitHub ↗

What a subject's first link is when it names a declaration: a class (a value of it when called, a typecast), or a value of a type.

(decl: Node, link: SubjectLink, context: ResolutionContext)

Source from the content-addressed store, hash-verified

1609
1610/** What a subject's first link is when it names a declaration: a class (a value of it when called, a typecast), or a value of a type. */
1611function valueOfDeclaration(decl: Node, link: SubjectLink, context: ResolutionContext): { type: Node | null; classRef: boolean } {
1612 if (CLASS_KINDS.has(decl.kind)) return { type: decl, classRef: !link.called };
1613 if (decl.kind === 'type_alias') return { type: classNamed(decl.name, decl.filePath, context), classRef: !link.called };
1614 return { type: valueTypeOf(decl, link.indexed, context), classRef: false };
1615}
1616
1617/**
1618 * The class a member's value is of: a field's, a variable's or a property's

Callers 1

typeOfLinksFunction · 0.85

Calls 3

valueTypeOfFunction · 0.85
hasMethod · 0.80
classNamedFunction · 0.70

Tested by

no test coverage detected