Skip to content

Commit cd9aab8

Browse files
committed
Change visitor argument name to node.
Signed-off-by: James Goppert <james.goppert@gmail.com>
1 parent 383c0a3 commit cd9aab8

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/s2_analysis/print_visitor.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ impl Visitor for PrintVisitor {
3030
self.level -= 1;
3131
}
3232

33-
fn enter_stored_definition(&mut self, _def: &mut ast::StoredDefinition) {
34-
self.print("Stored Definition");
33+
fn enter_stored_definition(&mut self, _node: &mut ast::StoredDefinition) {
34+
self.print("Stored definition");
3535
}
3636

37-
fn enter_class_definition(&mut self, def: &mut ast::ClassDefinition) {
38-
if let ast::ClassSpecifier::Long { name, .. } = &def.specifier {
37+
fn enter_class_definition(&mut self, node: &mut ast::ClassDefinition) {
38+
if let ast::ClassSpecifier::Long { name, .. } = &node.specifier {
3939
self.print(&format!("class {}", name));
4040
}
4141
}
4242

43-
fn exit_class_definition(&mut self, _def: &mut ast::ClassDefinition) {
43+
fn exit_class_definition(&mut self, _node: &mut ast::ClassDefinition) {
4444
println!("\n");
4545
}
4646

47-
fn enter_expression(&mut self, def: &mut ast::Expression) {
48-
match def {
47+
fn enter_expression(&mut self, node: &mut ast::Expression) {
48+
match node {
4949
ast::Expression::Binary { op, .. } => {
5050
self.print(&format!("{:?}", op));
5151
}
@@ -79,8 +79,8 @@ impl Visitor for PrintVisitor {
7979
}
8080
}
8181

82-
fn enter_equation(&mut self, def: &mut ast::Equation) {
83-
match def {
82+
fn enter_equation(&mut self, node: &mut ast::Equation) {
83+
match node {
8484
ast::Equation::Connect { .. } => {
8585
self.print("connect");
8686
}
@@ -94,14 +94,14 @@ impl Visitor for PrintVisitor {
9494
}
9595
}
9696

97-
fn enter_component_declaration(&mut self, def: &mut ast::ComponentDeclaration) {
98-
self.print(&format!("component: {}", def.declaration.name));
97+
fn enter_component_declaration(&mut self, node: &mut ast::ComponentDeclaration) {
98+
self.print(&format!("component: {}", node.declaration.name));
9999
}
100100

101-
fn exit_component_reference(&mut self, def: &mut ast::ComponentReference) {
101+
fn exit_component_reference(&mut self, node: &mut ast::ComponentReference) {
102102
let mut s: String = "".to_string();
103-
for (index, part) in def.parts.iter().enumerate() {
104-
if index != 0 || def.local {
103+
for (index, part) in node.parts.iter().enumerate() {
104+
if index != 0 || node.local {
105105
s += ".";
106106
}
107107
s += &part.name;

src/s2_analysis/visitor.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ macro_rules! define_visitor_methods {
55
($($name:ident),*) => {
66
paste! {
77
$(
8-
fn [<enter_ $name:snake>](&mut self, _def: &mut ast::$name) {}
9-
fn [<exit_ $name:snake>](&mut self, _def: &mut ast::$name) {}
8+
#[allow(unused_variables)]
9+
fn [<enter_ $name:snake>](&mut self, node: &mut ast::$name) {}
10+
#[allow(unused_variables)]
11+
fn [<exit_ $name:snake>](&mut self, node: &mut ast::$name) {}
1012
)*
1113
}
1214
};

0 commit comments

Comments
 (0)