MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / with_callable_target_cache

Function with_callable_target_cache

src/completion/call_resolution.rs:178–187  ·  view source on GitHub ↗

Activate the thread-local callable target cache. While the returned guard is alive, `resolve_instance_method_callable` caches callable target resolutions by `"FQN::method_lower"` so that the same method on the same class is resolved at most once per diagnostic pass, regardless of how many different chain expressions lead to it.

()

Source from the content-addressed store, hash-verified

176/// diagnostic pass, regardless of how many different chain expressions
177/// lead to it.
178pub(crate) fn with_callable_target_cache() -> CallableTargetCacheGuard {
179 let already_active = CALLABLE_TARGET_CACHE.with(|cell| cell.borrow().is_some());
180 if already_active {
181 return CallableTargetCacheGuard { owns: false };
182 }
183 CALLABLE_TARGET_CACHE.with(|cell| {
184 *cell.borrow_mut() = Some(HashMap::new());
185 });
186 CallableTargetCacheGuard { owns: true }
187}
188
189// ── Body return type inference ──────────────────────────────────────────────
190

Callers 2

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected