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

Method gateRustScope

src/resolution/index.ts:4455–4465  ·  view source on GitHub ↗

* A bare Rust name reaches only what is in scope — every strategy's result, * a framework resolver's `Ok(x)` → `struct Ok` construction included (see * isRustNameInScope). A call through a path whose type is from outside the * project reaches only the project's impls for that type (or of th

(result: ResolvedRef | null, ref: UnresolvedRef)

Source from the content-addressed store, hash-verified

4453 * impl on a std type only as Rust would pick it (isRustForeignImplCallable).
4454 */
4455 private gateRustScope(result: ResolvedRef | null, ref: UnresolvedRef): ResolvedRef | null {
4456 if (!result || ref.language !== 'rust') return result;
4457 const bare = /^[A-Za-z_]\w*$/.test(ref.referenceName);
4458 if (!bare && ref.referenceKind !== 'calls') return result;
4459 const target = this.nodeById(result.targetNodeId);
4460 if (!target) return result;
4461 if (bare && !isRustNameInScope(target, ref, this.context)) return null;
4462 if (ref.referenceKind !== 'calls') return result;
4463 if (!bare && !isRustPathCallReachable(target, ref, this.context)) return null;
4464 return isRustForeignImplCallable(target, ref, this.context) ? result : null;
4465 }
4466
4467 /**
4468 * The context production code is resolved in when the project has Jest or

Callers 1

resolveOneInMethod · 0.95

Calls 1

nodeByIdMethod · 0.95

Tested by

no test coverage detected