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

Function routineKeyword

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

The keyword that declares a routine (`function`, `procedure`, `constructor`, …), lowercased, or null.

(routine: Node, context: ResolutionContext)

Source from the content-addressed store, hash-verified

1259
1260/** The keyword that declares a routine (`function`, `procedure`, `constructor`, …), lowercased, or null. */
1261function routineKeyword(routine: Node, context: ResolutionContext): string | null {
1262 const memo = memos(context).keywords;
1263 const hit = memo.get(routine.id);
1264 if (hit !== undefined) return hit;
1265 const line = fileLines(routine.filePath, context)[routine.startLine - 1] ?? '';
1266 const keyword = /\b(function|procedure|constructor|destructor|operator)\s/i.exec(line)?.[1]!.toLowerCase() ?? null;
1267 memo.set(routine.id, keyword);
1268 return keyword;
1269}

Callers 3

matchPascalParenlessRefFunction · 0.85
memberAtPathFunction · 0.85
yieldsValueFunction · 0.85

Calls 5

memosFunction · 0.85
fileLinesFunction · 0.85
getMethod · 0.65
execMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected