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

Function routineTypeVerdict

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

* 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)

Source from the content-addressed store, hash-verified

1165 * routine type (`TStringList`) or text that names no type (`array of TFoo`).
1166 */
1167function 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. */
1180const SYSTEM_VALUE_TYPES: ReadonlySet<string> = new Set([

Callers 3

assignedRoutineTypeFunction · 0.85
returnsRoutineTypeFunction · 0.85
isProceduralTypeTextFunction · 0.85

Calls 5

typesNamedFunction · 0.85
isProceduralTypeTextFunction · 0.85
aliasedTypeTextFunction · 0.85
hasMethod · 0.80
execMethod · 0.65

Tested by

no test coverage detected