* 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)
| 598 | * Undefined when the declaration, or what its type is, can't be read. |
| 599 | */ |
| 600 | function 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`). */ |
| 612 | function returnsRoutineType(routine: Node, context: ResolutionContext): boolean { |
no test coverage detected