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

Function seed_this

src/completion/variable/forward_walk.rs:1533–1541  ·  view source on GitHub ↗

Recursively walk the AST to find function and method bodies, running the forward walker on each. Seed `$this` in the scope when inside a non-static class method. This creates a `ResolvedType` from the enclosing `ClassInfo` and stores it under `"$this"`. The scope-based variable resolver then returns this entry for any `$this` lookup, eliminating the need to remain unresolved.

(scope: &mut ScopeState, current_class: &ClassInfo)

Source from the content-addressed store, hash-verified

1531/// returns this entry for any `$this` lookup, eliminating the need to
1532/// remain unresolved.
1533fn seed_this(scope: &mut ScopeState, current_class: &ClassInfo) {
1534 if current_class.name.is_empty() {
1535 return;
1536 }
1537 scope.set(
1538 "$this",
1539 vec![ResolvedType::from_class(current_class.clone())],
1540 );
1541}
1542
1543/// Walk a sequence of top-level (or namespace-level) statements,
1544/// maintaining a shared `ScopeState` for code that lives outside any

Callers 2

analyze_function_bodyFunction · 0.85
resolve_in_method_bodyFunction · 0.85

Calls 2

setMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected