librustc: Change fold to use traits instead of @fn.

This commit is contained in:
Patrick Walton
2013-08-29 12:10:02 -07:00
parent 9705399504
commit 3e5de06135
12 changed files with 1335 additions and 1258 deletions

View File

@@ -12,7 +12,6 @@ use ast::*;
use ast;
use ast_util;
use codemap::{Span, dummy_sp};
use fold;
use opt_vec;
use parse::token;
use visit::Visitor;
@@ -371,21 +370,6 @@ pub fn empty_generics() -> Generics {
ty_params: opt_vec::Empty}
}
///////////////////////////////////////////////////////////////////////////
// Assigning node ids
fn node_id_assigner(next_id: @fn() -> ast::NodeId) -> @fold::ast_fold {
let precursor = @fold::AstFoldFns {
new_id: |old_id| {
assert_eq!(old_id, ast::DUMMY_NODE_ID);
next_id()
},
..*fold::default_ast_fold()
};
fold::make_fold(precursor)
}
// ______________________________________________________________________
// Enumerating the IDs which appear in an AST