pub struct ScopeAnalyzer;Expand description
Analyzes an AST for scope-related issues such as unused variables and shadowing.
Produces a list of ScopeIssues that can be surfaced as LSP diagnostics
or used by the refactoring engine. The analyzer is stateless and may be
reused across multiple invocations.
Implementations§
Source§impl ScopeAnalyzer
impl ScopeAnalyzer
Sourcepub fn new() -> ScopeAnalyzer
pub fn new() -> ScopeAnalyzer
Create a new scope analyzer instance.
Sourcepub fn analyze(
&self,
ast: &Node,
code: &str,
pragma_map: &[(Range<usize>, PragmaState)],
) -> Vec<ScopeIssue>
pub fn analyze( &self, ast: &Node, code: &str, pragma_map: &[(Range<usize>, PragmaState)], ) -> Vec<ScopeIssue>
Analyze ast for scope issues, using pragma_map to honour use strict regions.
Returns all detected issues sorted by byte offset.
Sourcepub fn get_suggestions(&self, issues: &[ScopeIssue]) -> Vec<String>
pub fn get_suggestions(&self, issues: &[ScopeIssue]) -> Vec<String>
Return one human-readable fix suggestion per issue.
Trait Implementations§
Source§impl Default for ScopeAnalyzer
impl Default for ScopeAnalyzer
Source§fn default() -> ScopeAnalyzer
fn default() -> ScopeAnalyzer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ScopeAnalyzer
impl RefUnwindSafe for ScopeAnalyzer
impl Send for ScopeAnalyzer
impl Sync for ScopeAnalyzer
impl Unpin for ScopeAnalyzer
impl UnsafeUnpin for ScopeAnalyzer
impl UnwindSafe for ScopeAnalyzer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more