Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 52 additions & 4 deletions crates/lint/src/linter/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ pub trait LateLintPass<'hir>: Send + Sync {
&mut self,
_ctx: &LintContext,
_hir: &'hir hir::Hir<'hir>,
_id: &'hir hir::ItemId,
_id: hir::ItemId,
) {
}
fn check_nested_contract(
&mut self,
_ctx: &LintContext,
_hir: &'hir hir::Hir<'hir>,
_id: &'hir hir::ContractId,
_id: hir::ContractId,
) {
}
fn check_nested_function(
&mut self,
_ctx: &LintContext,
_hir: &'hir hir::Hir<'hir>,
_id: &'hir hir::FunctionId,
_id: hir::FunctionId,
) {
}
fn check_nested_var(
&mut self,
_ctx: &LintContext,
_hir: &'hir hir::Hir<'hir>,
_id: &'hir hir::VariableId,
_id: hir::VariableId,
) {
}
fn check_item(
Expand Down Expand Up @@ -143,6 +143,34 @@ where
self.walk_nested_source(id)
}

fn visit_nested_item(&mut self, id: hir::ItemId) -> ControlFlow<Self::BreakValue> {
for pass in self.passes.iter_mut() {
pass.check_nested_item(self.ctx, self.hir, id);
}
self.walk_nested_item(id)
}

fn visit_nested_contract(&mut self, id: hir::ContractId) -> ControlFlow<Self::BreakValue> {
for pass in self.passes.iter_mut() {
pass.check_nested_contract(self.ctx, self.hir, id);
}
self.walk_nested_contract(id)
}

fn visit_nested_function(&mut self, id: hir::FunctionId) -> ControlFlow<Self::BreakValue> {
for pass in self.passes.iter_mut() {
pass.check_nested_function(self.ctx, self.hir, id);
}
self.walk_nested_function(id)
}

fn visit_nested_var(&mut self, id: hir::VariableId) -> ControlFlow<Self::BreakValue> {
for pass in self.passes.iter_mut() {
pass.check_nested_var(self.ctx, self.hir, id);
}
self.walk_nested_var(id)
}

fn visit_contract(
&mut self,
contract: &'hir hir::Contract<'hir>,
Expand All @@ -160,6 +188,16 @@ where
self.walk_function(func)
}

fn visit_modifier(
&mut self,
modifier: &'hir hir::Modifier<'hir>,
) -> ControlFlow<Self::BreakValue> {
for pass in self.passes.iter_mut() {
pass.check_modifier(self.ctx, self.hir, modifier);
}
self.walk_modifier(modifier)
}

fn visit_item(&mut self, item: hir::Item<'hir, 'hir>) -> ControlFlow<Self::BreakValue> {
for pass in self.passes.iter_mut() {
pass.check_item(self.ctx, self.hir, item);
Expand All @@ -181,6 +219,16 @@ where
self.walk_expr(expr)
}

fn visit_call_args(
&mut self,
args: &'hir hir::CallArgs<'hir>,
) -> ControlFlow<Self::BreakValue> {
for pass in self.passes.iter_mut() {
pass.check_call_args(self.ctx, self.hir, args);
}
self.walk_call_args(args)
}

fn visit_stmt(&mut self, stmt: &'hir hir::Stmt<'hir>) -> ControlFlow<Self::BreakValue> {
for pass in self.passes.iter_mut() {
pass.check_stmt(self.ctx, self.hir, stmt);
Expand Down