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

Function assignedRoutineType

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

* Whether the target a value is assigned to is declared with a routine type * (see the file comment): the field, property or variable a name reaches in * scope, or through a receiver (`FEvents.OnGet`, `Self.Callback`), or the * declared type of a local (`:TGet`, `:procedure` for one written out).

(target: string, cls: Node | null, ref: UnresolvedRef, context: ResolutionContext)

Source from the content-addressed store, hash-verified

598 * Undefined when the declaration, or what its type is, can't be read.
599 */
600function assignedRoutineType(target: string, cls: Node | null, ref: UnresolvedRef, context: ResolutionContext): boolean | undefined {
601 const links = target.split('.');
602 if (links.length === 1 && links[0]!.startsWith(':')) return routineTypeVerdict(links[0]!.slice(1), context, 0);
603 const node = links.length === 1
604 ? declarationInScope(links[0]!.toLowerCase(), cls, ref, context)?.node
605 : memberAtPath(links, cls, ref, context)?.node;
606 if (!node || !DATA_KINDS.has(node.kind) || node.kind === 'enum_member') return undefined;
607 const text = declaredTypeText(node, context);
608 return text ? routineTypeVerdict(text, context, 0) : undefined;
609}
610
611/** Whether a function's result is of a routine type (`function MakeHandler: TNotifyEvent`). */
612function returnsRoutineType(routine: Node, context: ResolutionContext): boolean {

Callers 1

matchPascalParenlessRefFunction · 0.85

Calls 5

routineTypeVerdictFunction · 0.85
declarationInScopeFunction · 0.85
memberAtPathFunction · 0.85
declaredTypeTextFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected