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

Function is_catch_frame_parameter

src/diagnostics/unused_variables.rs:452–465  ·  view source on GitHub ↗

Check whether a variable at the given offset is a catch frame's parameter declaration within the given parent frame.

(
    name: &str,
    offset: u32,
    parent: &crate::scope_collector::Frame,
    frames: &[crate::scope_collector::Frame],
)

Source from the content-addressed store, hash-verified

450/// Check whether a variable at the given offset is a catch frame's
451/// parameter declaration within the given parent frame.
452fn is_catch_frame_parameter(
453 name: &str,
454 offset: u32,
455 parent: &crate::scope_collector::Frame,
456 frames: &[crate::scope_collector::Frame],
457) -> bool {
458 frames.iter().any(|f| {
459 f.kind == FrameKind::Catch
460 && f.start > parent.start
461 && f.end < parent.end
462 && f.parameters.iter().any(|p| p.as_str() == name)
463 && offset < f.start
464 })
465}
466
467/// Check whether `offset` falls inside any nested frame (closure,
468/// arrow function, or catch) within the given parent frame.

Callers 1

check_scopeFunction · 0.85

Calls 2

iterMethod · 0.80
as_strMethod · 0.80

Tested by

no test coverage detected