Get rid of unused SimpleVisitor stuff.

This commit is contained in:
Lindsey Kuper 2013-09-14 01:10:48 -04:00
parent 52b9688f92
commit 940a86b760
2 changed files with 3 additions and 144 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
@ -15,7 +15,7 @@ use codemap::{Span, dummy_sp};
use fold; use fold;
use opt_vec; use opt_vec;
use parse::token; use parse::token;
use visit::{SimpleVisitor, Visitor}; use visit::Visitor;
use visit; use visit;
use std::hashmap::HashMap; use std::hashmap::HashMap;

View File

@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT. // http://rust-lang.org/COPYRIGHT.
// //
@ -668,144 +668,3 @@ pub fn walk_arm<E:Clone, V:Visitor<E>>(visitor: &mut V, arm: &Arm, env: E) {
walk_expr_opt(visitor, arm.guard, env.clone()); walk_expr_opt(visitor, arm.guard, env.clone());
visitor.visit_block(&arm.body, env) visitor.visit_block(&arm.body, env)
} }
// Simpler, non-context passing interface. Always walks the whole tree, simply
// calls the given functions on the nodes.
pub trait SimpleVisitor {
fn visit_mod(&mut self, &_mod, Span, NodeId);
fn visit_view_item(&mut self, &view_item);
fn visit_foreign_item(&mut self, @foreign_item);
fn visit_item(&mut self, @item);
fn visit_local(&mut self, @Local);
fn visit_block(&mut self, &Block);
fn visit_stmt(&mut self, @Stmt);
fn visit_arm(&mut self, &Arm);
fn visit_pat(&mut self, @Pat);
fn visit_decl(&mut self, @Decl);
fn visit_expr(&mut self, @Expr);
fn visit_expr_post(&mut self, @Expr);
fn visit_ty(&mut self, &Ty);
fn visit_generics(&mut self, &Generics);
fn visit_fn(&mut self, &fn_kind, &fn_decl, &Block, Span, NodeId);
fn visit_ty_method(&mut self, &TypeMethod);
fn visit_trait_method(&mut self, &trait_method);
fn visit_struct_def(&mut self, @struct_def, Ident, &Generics, NodeId);
fn visit_struct_field(&mut self, @struct_field);
fn visit_struct_method(&mut self, @method);
}
pub struct SimpleVisitorVisitor {
simple_visitor: @mut SimpleVisitor,
}
impl Visitor<()> for SimpleVisitorVisitor {
fn visit_mod(&mut self,
module: &_mod,
span: Span,
node_id: NodeId,
env: ()) {
self.simple_visitor.visit_mod(module, span, node_id);
walk_mod(self, module, env)
}
fn visit_view_item(&mut self, view_item: &view_item, env: ()) {
self.simple_visitor.visit_view_item(view_item);
walk_view_item(self, view_item, env)
}
fn visit_foreign_item(&mut self, foreign_item: @foreign_item, env: ()) {
self.simple_visitor.visit_foreign_item(foreign_item);
walk_foreign_item(self, foreign_item, env)
}
fn visit_item(&mut self, item: @item, env: ()) {
self.simple_visitor.visit_item(item);
walk_item(self, item, env)
}
fn visit_local(&mut self, local: @Local, env: ()) {
self.simple_visitor.visit_local(local);
walk_local(self, local, env)
}
fn visit_block(&mut self, block: &Block, env: ()) {
self.simple_visitor.visit_block(block);
walk_block(self, block, env)
}
fn visit_stmt(&mut self, statement: @Stmt, env: ()) {
self.simple_visitor.visit_stmt(statement);
walk_stmt(self, statement, env)
}
fn visit_arm(&mut self, arm: &Arm, env: ()) {
self.simple_visitor.visit_arm(arm);
walk_arm(self, arm, env)
}
fn visit_pat(&mut self, pattern: @Pat, env: ()) {
self.simple_visitor.visit_pat(pattern);
walk_pat(self, pattern, env)
}
fn visit_decl(&mut self, declaration: @Decl, env: ()) {
self.simple_visitor.visit_decl(declaration);
walk_decl(self, declaration, env)
}
fn visit_expr(&mut self, expression: @Expr, env: ()) {
self.simple_visitor.visit_expr(expression);
walk_expr(self, expression, env)
}
fn visit_expr_post(&mut self, expression: @Expr, _: ()) {
self.simple_visitor.visit_expr_post(expression)
}
fn visit_ty(&mut self, typ: &Ty, env: ()) {
self.simple_visitor.visit_ty(typ);
walk_ty(self, typ, env)
}
fn visit_generics(&mut self, generics: &Generics, env: ()) {
self.simple_visitor.visit_generics(generics);
walk_generics(self, generics, env)
}
fn visit_fn(&mut self,
function_kind: &fn_kind,
function_declaration: &fn_decl,
block: &Block,
span: Span,
node_id: NodeId,
env: ()) {
self.simple_visitor.visit_fn(function_kind,
function_declaration,
block,
span,
node_id);
walk_fn(self,
function_kind,
function_declaration,
block,
span,
node_id,
env)
}
fn visit_ty_method(&mut self, method_type: &TypeMethod, env: ()) {
self.simple_visitor.visit_ty_method(method_type);
walk_ty_method(self, method_type, env)
}
fn visit_trait_method(&mut self, trait_method: &trait_method, env: ()) {
self.simple_visitor.visit_trait_method(trait_method);
walk_trait_method(self, trait_method, env)
}
fn visit_struct_def(&mut self,
struct_definition: @struct_def,
identifier: Ident,
generics: &Generics,
node_id: NodeId,
env: ()) {
self.simple_visitor.visit_struct_def(struct_definition,
identifier,
generics,
node_id);
walk_struct_def(self,
struct_definition,
identifier,
generics,
node_id,
env)
}
fn visit_struct_field(&mut self, struct_field: @struct_field, env: ()) {
self.simple_visitor.visit_struct_field(struct_field);
walk_struct_field(self, struct_field, env)
}
}