* Whether a written type is a routine's (see isProceduralTypeText): false * for one of the System unit's value types, and undefined when nothing says, * for a name neither the project declares nor the RTL's names say is a * routine type (`TStringList`) or text that names no type (`array of TFoo`)
(text: string, context: ResolutionContext, depth: number)
| 1165 | * routine type (`TStringList`) or text that names no type (`array of TFoo`). |
| 1166 | */ |
| 1167 | function routineTypeVerdict(text: string, context: ResolutionContext, depth: number): boolean | undefined { |
| 1168 | if (PROCEDURAL_TYPE.test(text)) return true; |
| 1169 | const typeName = /^(?:type\s+)?([A-Za-z_][\w.]*)/i.exec(text)?.[1]?.split('.').pop()?.toLowerCase(); |
| 1170 | if (!typeName || depth > 3) return undefined; |
| 1171 | const types = typesNamed(typeName, context); |
| 1172 | if (types.length === 0) { |
| 1173 | if (RTL_PROCEDURAL_TYPES.has(typeName) || /^t\w*(?:event|proc|method|callback)$/.test(typeName)) return true; |
| 1174 | return SYSTEM_VALUE_TYPES.has(typeName) ? false : undefined; |
| 1175 | } |
| 1176 | return types.some((t) => t.kind === 'type_alias' && isProceduralTypeText(aliasedTypeText(t, context), context, depth + 1)); |
| 1177 | } |
| 1178 | |
| 1179 | /** The System unit's value types, lowercased, which hold no routine. */ |
| 1180 | const SYSTEM_VALUE_TYPES: ReadonlySet<string> = new Set([ |
no test coverage detected