rustc: Move next_var_id from typeck.crate_ctxt to typeck.fn_ctxt
This commit is contained in:
parent
368459db43
commit
c3ab601a89
1 changed files with 7 additions and 6 deletions
|
@ -18,11 +18,11 @@ import std.option.some;
|
|||
|
||||
type ty_table = hashmap[ast.def_id, @ty];
|
||||
type crate_ctxt = rec(session.session sess,
|
||||
@ty_table item_types,
|
||||
mutable int next_var_id);
|
||||
@ty_table item_types);
|
||||
|
||||
type fn_ctxt = rec(@ty ret_ty,
|
||||
@ty_table locals,
|
||||
mutable int next_var_id,
|
||||
@crate_ctxt ccx);
|
||||
|
||||
type arg = rec(ast.mode mode, @ty ty);
|
||||
|
@ -1695,8 +1695,8 @@ fn check_expr(&fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
|
|||
}
|
||||
|
||||
fn next_ty_var(&fn_ctxt fcx) -> @ty {
|
||||
auto t = plain_ty(ty_var(fcx.ccx.next_var_id));
|
||||
fcx.ccx.next_var_id += 1;
|
||||
auto t = plain_ty(ty_var(fcx.next_var_id));
|
||||
fcx.next_var_id += 1;
|
||||
ret t;
|
||||
}
|
||||
|
||||
|
@ -1814,6 +1814,7 @@ fn check_const(&@crate_ctxt ccx, &span sp, ast.ident ident, @ast.ty t,
|
|||
auto rty = ann_to_type(ann);
|
||||
let fn_ctxt fcx = rec(ret_ty = rty,
|
||||
locals = @common.new_def_hash[@ty](),
|
||||
mutable next_var_id = 0,
|
||||
ccx = ccx);
|
||||
auto e_ = check_expr(fcx, e);
|
||||
// FIXME: necessary? Correct sequence?
|
||||
|
@ -1845,6 +1846,7 @@ fn check_fn(&@crate_ctxt ccx, &span sp, ast.ident ident, &ast._fn f,
|
|||
|
||||
let fn_ctxt fcx = rec(ret_ty = output_ty,
|
||||
locals = local_ty_table,
|
||||
mutable next_var_id = 0,
|
||||
ccx = ccx);
|
||||
|
||||
// TODO: Make sure the type of the block agrees with the function type.
|
||||
|
@ -1861,8 +1863,7 @@ fn check_crate(session.session sess, @ast.crate crate) -> @ast.crate {
|
|||
auto result = collect_item_types(crate);
|
||||
|
||||
auto ccx = @rec(sess=sess,
|
||||
item_types=result._1,
|
||||
mutable next_var_id=0);
|
||||
item_types=result._1);
|
||||
|
||||
auto fld = fold.new_identity_fold[@crate_ctxt]();
|
||||
auto f = check_fn; // FIXME: trans_const_lval bug
|
||||
|
|
Loading…
Reference in a new issue