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

Function routineKeyword

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

2795
2796/** The keyword that declares a routine (`function`, `procedure`, `constructor`, …), lowercased, or null. */
2797function routineKeyword(routine: Node, context: ResolutionContext): string | null {
2798 const memo = memos(context).keywords;
2799 const hit = memo.get(routine.id);
2800 if (hit !== undefined) return hit;
2801 const line = fileLines(routine.filePath, context)[routine.startLine - 1] ?? '';
2802 const keyword = /\b(function|procedure|constructor|destructor|operator)\s/i.exec(line)?.[1]!.toLowerCase() ?? null;
2803 memo.set(routine.id, keyword);
2804 return keyword;
2805}

Callers 5

matchPascalParenlessRefFunction · 0.85
classInitializerFunction · 0.85
memberAtPathFunction · 0.85
typeOfLinksFunction · 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