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

Function assignedRoutineType

src/resolution/pascal-scope.ts:1109–1118  ·  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

1107 * Undefined when the declaration, or what its type is, can't be read.
1108 */
1109function assignedRoutineType(target: string, cls: Node | null, ref: UnresolvedRef, context: ResolutionContext): boolean | undefined {
1110 const links = target.split('.');
1111 if (links.length === 1 && links[0]!.startsWith(':')) return routineTypeVerdict(links[0]!.slice(1), context, 0);
1112 const node = links.length === 1
1113 ? declarationInScope(links[0]!.toLowerCase(), cls, ref, context)?.node
1114 : memberAtPath(links, cls, ref, context)?.node;
1115 if (!node || !DATA_KINDS.has(node.kind) || node.kind === 'enum_member') return undefined;
1116 const text = declaredTypeText(node, context);
1117 return text ? routineTypeVerdict(text, context, 0) : undefined;
1118}
1119
1120/** Whether a function's result is of a routine type (`function MakeHandler: TNotifyEvent`). */
1121function 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