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

Function pascalParameterTypes

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

* The type of each of a Pascal routine's parameters, with how it is passed * (`const integer`, `var tstrings`), from its signature * (`(const A, B: Integer; var L: TStrings)`); [] for none, null when the * signature can't be read.

(signature: string | undefined)

Source from the content-addressed store, hash-verified

623 * signature can't be read.
624 */
625function pascalParameterTypes(signature: string | undefined): string[] | null {
626 const groups = pascalParameterGroups(signature);
627 if (!groups) return null;
628 const types: string[] = [];
629 for (const group of groups) {
630 const colon = group.indexOf(':');
631 const passed = /^\s*(?:\[[^\]]*\]\s*)*(const|constref|var|out)\b/i.exec(group)?.[1]?.toLowerCase() ?? '';
632 const type = colon < 0 ? '' : group.slice(colon + 1).replace(/=[\s\S]*$/, '').replace(/\s+/g, ' ').trim().toLowerCase();
633 for (let k = groupNames(group).length; k > 0; k--) types.push(`${passed} ${type}`);
634 }
635 return types;
636}
637
638/** The names a parameter group declares (`const A, B: Integer` → A, B). */
639function groupNames(group: string): string[] {

Callers 2

matchPascalInheritedCallFunction · 0.85
sameTypesFunction · 0.85

Calls 4

pascalParameterGroupsFunction · 0.85
groupNamesFunction · 0.85
pushMethod · 0.80
execMethod · 0.65

Tested by

no test coverage detected