diff options
| author | Patrick Walton <[email protected]> | 2010-12-11 22:37:23 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-12-11 22:37:23 -0800 |
| commit | c3ab601a89f10490aa61e55149d8c01cc61941a1 (patch) | |
| tree | bf4b4e5971a305008fb9a528f3efb02181ab070a /src/comp | |
| parent | rustc: Remove "update_env_for_arm" debugging message (diff) | |
| download | rust-c3ab601a89f10490aa61e55149d8c01cc61941a1.tar.xz rust-c3ab601a89f10490aa61e55149d8c01cc61941a1.zip | |
rustc: Move next_var_id from typeck.crate_ctxt to typeck.fn_ctxt
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/typeck.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 1ec4fe25..ca8c26fe 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -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 |