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