Skip to content

Commit

Permalink
move check_const to dvec
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis committed Jun 7, 2012
1 parent 08520a1 commit 7d17c2d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/rustc/middle/check_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import syntax::ast::*;
import syntax::{visit, ast_util, ast_map};
import driver::session::session;
import std::map::hashmap;
import dvec::{dvec, extensions};

fn check_crate(sess: session, crate: @crate, ast_map: ast_map::map,
def_map: resolve::def_map,
Expand Down Expand Up @@ -130,15 +131,15 @@ fn check_item_recursion(sess: session, ast_map: ast_map::map,
sess: session,
ast_map: ast_map::map,
def_map: resolve::def_map,
idstack: @mut [node_id],
idstack: @dvec<node_id>,
};

let env = {
root_it: it,
sess: sess,
ast_map: ast_map,
def_map: def_map,
idstack: @mut []
idstack: @dvec()
};

let visitor = visit::mk_vt(@{
Expand All @@ -152,9 +153,9 @@ fn check_item_recursion(sess: session, ast_map: ast_map::map,
if (*env.idstack).contains(it.id) {
env.sess.span_fatal(env.root_it.span, "recursive constant");
}
vec::push(*env.idstack, it.id);
(*env.idstack).push(it.id);
visit::visit_item(it, env, v);
vec::pop(*env.idstack);
(*env.idstack).pop();
}

fn visit_expr(e: @expr, &&env: env, v: visit::vt<env>) {
Expand Down

0 comments on commit 7d17c2d

Please sign in to comment.