1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 //! This module shows spans for all expressions in the crate
14 //! to help with compiler debugging.
18 use syntax::visit::Visitor;
20 use driver::session::Session;
22 struct ShowSpanVisitor<'a> {
26 impl<'a, 'v> Visitor<'v> for ShowSpanVisitor<'a> {
27 fn visit_expr(&mut self, e: &ast::Expr) {
28 self.sess.span_note(e.span, "expression");
29 visit::walk_expr(self, e);
32 fn visit_mac(&mut self, macro: &ast::Mac) {
33 visit::walk_mac(self, macro);
37 pub fn run(sess: &Session, krate: &ast::Crate) {
38 let mut v = ShowSpanVisitor { sess: sess };
39 visit::walk_crate(&mut v, krate);