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

Function matchScopedCallChain

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

Source from the content-addressed store, hash-verified

893 * edge rather than a wrong one. Shared by the `::`-receiver languages (PHP, Rust).
894 */
895export function matchScopedCallChain(
896 ref: UnresolvedRef,
897 context: ResolutionContext,
898): ResolvedRef | null {
899 const m = ref.referenceName.match(/^(.+)\(\)\.(\w+)$/);
900 if (!m || !m[1] || !m[2]) return null;
901 const inner = m[1];
902 const method = m[2];
903 if (!inner.includes('::')) return null; // only static-factory (`Cls::method`) chains
904 const factoryClass = inner.slice(0, inner.lastIndexOf('::'));
905 const ret = lookupCalleeReturnType(inner, ref, context);
906 if (!ret) return null;
907 // `self` (the extractor's marker for self/static/$this) → the factory's class.
908 const resolvedClass = ret === 'self' ? factoryClass : ret;
909 return resolveMethodOnType(resolvedClass, method, ref, context, 0.85, 'instance-method');
910}
911
912/**
913 * 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