Extract the subject before `->` for method calls. `arrow_pos` points to the `-` of `->`. Handles `$this`, `$var`, and simple variable names.
(chars: &[char], arrow_pos: usize)
| 319 | /// `arrow_pos` points to the `-` of `->`. |
| 320 | /// Handles `$this`, `$var`, and simple variable names. |
| 321 | pub fn extract_subject_before_arrow(chars: &[char], arrow_pos: usize) -> String { |
| 322 | let mut i = arrow_pos; |
| 323 | // Skip whitespace |
| 324 | while i > 0 && chars[i - 1] == ' ' { |
| 325 | i -= 1; |
| 326 | } |
| 327 | |
| 328 | // Check for `)` — chained call, skip for now |
| 329 | if i > 0 && chars[i - 1] == ')' { |
| 330 | return String::new(); |
| 331 | } |
| 332 | |
| 333 | // Read identifier (property or variable name without `$`) |
| 334 | let end = i; |
| 335 | while i > 0 && (chars[i - 1].is_alphanumeric() || chars[i - 1] == '_') { |
| 336 | i -= 1; |
| 337 | } |
| 338 | |
| 339 | // Check for `$` prefix (variable) |
| 340 | if i > 0 && chars[i - 1] == '$' { |
| 341 | i -= 1; |
| 342 | return chars[i..end].iter().collect(); |
| 343 | } |
| 344 | |
| 345 | // Could be a chained property: `$this->prop->method(` — just return |
| 346 | // the identifier; resolution in server.rs will handle it. |
| 347 | chars[i..end].iter().collect() |
| 348 | } |
| 349 | |
| 350 | /// Extract a class name (possibly namespace-qualified) before `::`. |
| 351 | /// |
no test coverage detected