diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2017-05-12 07:15:29 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2017-05-12 07:15:29 +1200 |
| commit | fb7ba4772cdad24083fa73552425d4f91fd8be33 (patch) | |
| tree | 06138ef4c6c971eeb4b5b709c511fe9908306eed /src/libsyntax | |
| parent | 67a0d27c6529de335304b10c6ae6b0eed77bfc79 (diff) | |
| download | rust-fb7ba4772cdad24083fa73552425d4f91fd8be33.tar.gz rust-fb7ba4772cdad24083fa73552425d4f91fd8be33.zip | |
Pass crate attributes in visit.rs
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/util/node_count.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/libsyntax/util/node_count.rs b/src/libsyntax/util/node_count.rs index 9d9957a0f45..0a5d0c2e7fe 100644 --- a/src/libsyntax/util/node_count.rs +++ b/src/libsyntax/util/node_count.rs @@ -31,7 +31,7 @@ impl<'ast> Visitor<'ast> for NodeCounter { self.count += 1; walk_ident(self, span, ident); } - fn visit_mod(&mut self, m: &Mod, _s: Span, _n: NodeId) { + fn visit_mod(&mut self, m: &Mod, _s: Span, _a: &[Attribute], _n: NodeId) { self.count += 1; walk_mod(self, m) } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 2e42c6986e6..9288d95009c 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -56,7 +56,9 @@ pub trait Visitor<'ast>: Sized { fn visit_ident(&mut self, span: Span, ident: Ident) { walk_ident(self, span, ident); } - fn visit_mod(&mut self, m: &'ast Mod, _s: Span, _n: NodeId) { walk_mod(self, m) } + fn visit_mod(&mut self, m: &'ast Mod, _s: Span, _attrs: &[Attribute], _n: NodeId) { + walk_mod(self, m); + } fn visit_foreign_item(&mut self, i: &'ast ForeignItem) { walk_foreign_item(self, i) } fn visit_global_asm(&mut self, ga: &'ast GlobalAsm) { walk_global_asm(self, ga) } fn visit_item(&mut self, i: &'ast Item) { walk_item(self, i) } @@ -172,7 +174,7 @@ pub fn walk_ident<'a, V: Visitor<'a>>(visitor: &mut V, span: Span, ident: Ident) } pub fn walk_crate<'a, V: Visitor<'a>>(visitor: &mut V, krate: &'a Crate) { - visitor.visit_mod(&krate.module, krate.span, CRATE_NODE_ID); + visitor.visit_mod(&krate.module, krate.span, &krate.attrs, CRATE_NODE_ID); walk_list!(visitor, visit_attribute, &krate.attrs); } @@ -249,7 +251,7 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) { item.id) } ItemKind::Mod(ref module) => { - visitor.visit_mod(module, item.span, item.id) + visitor.visit_mod(module, item.span, &item.attrs, item.id) } ItemKind::ForeignMod(ref foreign_module) => { walk_list!(visitor, visit_foreign_item, &foreign_module.items); |
