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

Function routineTypeVerdict

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

2701 * routine type (`TStringList`) or text that names no type (`array of TFoo`).
2702 */
2703function routineTypeVerdict(text: string, context: ResolutionContext, depth: number): boolean | undefined {
2704 if (PROCEDURAL_TYPE.test(text)) return true;
2705 const typeName = /^(?:type\s+)?([A-Za-z_][\w.]*)/i.exec(text)?.[1]?.split('.').pop()?.toLowerCase();
2706 if (!typeName || depth > 3) return undefined;
2707 const types = typesNamed(typeName, context);
2708 if (types.length === 0) {
2709 if (RTL_PROCEDURAL_TYPES.has(typeName) || /^t\w*(?:event|proc|method|callback)$/.test(typeName)) return true;
2710 return SYSTEM_VALUE_TYPES.has(typeName) ? false : undefined;
2711 }
2712 return types.some((t) => t.kind === 'type_alias' && isProceduralTypeText(aliasedTypeText(t, context), context, depth + 1));
2713}
2714
2715/** The System unit's value types, lowercased, which hold no routine. */
2716const 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