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

Function classOfCall

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

* The class whose method makes a call: the one the nearest method header * above the call names in the source text (`procedure TFoo.Bar;`), which holds * where the tree had errors and gave the code to the file, or to a routine * that swallowed the ones after it; else the reference's method's clas

(ref: UnresolvedRef, context: ResolutionContext)

Source from the content-addressed store, hash-verified

281 * that swallowed the ones after it; else the reference's method's class.
282 */
283function classOfCall(ref: UnresolvedRef, context: ResolutionContext): Node | null {
284 const qn = headerClassAt(ref.filePath!, ref.line, context);
285 const cls = qn ? classByQualifiedName(qn, ref.filePath!, context) : null;
286 if (cls) return cls;
287 const routine = context.getNodeById?.(ref.fromNodeId);
288 return routine?.kind === 'method' ? classOfRoutine(routine, context) : null;
289}
290
291/**
292 * The class the nearest routine header at or above a line names

Callers 4

matchPascalSystemCallFunction · 0.85
gatePascalDataCallFunction · 0.85
matchPascalNestedCallFunction · 0.85
gatePascalNestedTargetFunction · 0.85

Calls 4

headerClassAtFunction · 0.85
classByQualifiedNameFunction · 0.85
classOfRoutineFunction · 0.85
getNodeByIdMethod · 0.65

Tested by

no test coverage detected