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

Function gatePascalDataCall

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

See gatePascalCall: a call resolved to data.

(target: Node, result: ResolvedRef, ref: UnresolvedRef, context: ResolutionContext)

Source from the content-addressed store, hash-verified

197
198/** See gatePascalCall: a call resolved to data. */
199function gatePascalDataCall(target: Node, result: ResolvedRef, ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null {
200 if (!isBareCall(ref, context)) return target.language === 'pascal' && isProceduralData(target, context) ? result : null;
201 const lower = ref.referenceName.toLowerCase();
202 if (declaredInRoutine(lower, ref, context)) return null;
203 const decl = declarationInScope(lower, classOfCall(ref, context), ref, context);
204 if (!decl) {
205 const only = target.language === 'pascal' && pascalNamed(lower, context).every((n) => n.id === target.id || n.kind === 'import');
206 return only && isProceduralData(target, context) ? result : null;
207 }
208 if (!isRoutine(decl.node) && !(DATA_KINDS.has(decl.node.kind) && isProceduralData(decl.node, context))) return null;
209 if (decl.node.id === target.id) return result;
210 context.rememberNode?.(decl.node);
211 return { ...result, targetNodeId: decl.node.id, confidence: decl.confidence, resolvedBy: decl.resolvedBy };
212}
213
214/**
215 * Whether the routine making a call declares the called name itself, as a

Callers 1

gatePascalCallFunction · 0.85

Calls 9

isBareCallFunction · 0.85
isProceduralDataFunction · 0.85
declaredInRoutineFunction · 0.85
declarationInScopeFunction · 0.85
classOfCallFunction · 0.85
pascalNamedFunction · 0.85
isRoutineFunction · 0.85
hasMethod · 0.80
rememberNodeMethod · 0.80

Tested by

no test coverage detected