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

Function matchScopedCallChain

src/resolution/name-matcher.ts:907–922  ·  view source on GitHub ↗
(
  ref: UnresolvedRef,
  context: ResolutionContext,
)

Source from the content-addressed store, hash-verified

905 * edge rather than a wrong one. Shared by the `::`-receiver languages (PHP, Rust).
906 */
907export function matchScopedCallChain(
908 ref: UnresolvedRef,
909 context: ResolutionContext,
910): ResolvedRef | null {
911 const m = ref.referenceName.match(/^(.+)\(\)\.(\w+)$/);
912 if (!m || !m[1] || !m[2]) return null;
913 const inner = m[1];
914 const method = m[2];
915 if (!inner.includes('::')) return null; // only static-factory (`Cls::method`) chains
916 const factoryClass = inner.slice(0, inner.lastIndexOf('::'));
917 const ret = lookupCalleeReturnType(inner, ref, context);
918 if (!ret) return null;
919 // `self` (the extractor's marker for self/static/$this) → the factory's class.
920 const resolvedClass = ret === 'self' ? factoryClass : ret;
921 return resolveMethodOnType(resolvedClass, method, ref, context, 0.85, 'instance-method');
922}
923
924/**
925 * Languages where an unprefixed capitalized call `Foo(args)` constructs the

Callers 2

matchReferenceFunction · 0.85

Calls 2

lookupCalleeReturnTypeFunction · 0.85
resolveMethodOnTypeFunction · 0.85

Tested by

no test coverage detected