diff options
| author | Marijn Haverbeke <[email protected]> | 2011-05-12 13:25:18 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <[email protected]> | 2011-05-12 15:40:21 +0200 |
| commit | 358a1aeec99ba6bf3c3f6bc5886e4dddf647a75a (patch) | |
| tree | 314e23b11b7fed0c6f667dfae66192ffd59566a4 /src/comp/front/eval.rs | |
| parent | Ensure ann tags are actually kept around during typechecking (diff) | |
| download | rust-358a1aeec99ba6bf3c3f6bc5886e4dddf647a75a.tar.xz rust-358a1aeec99ba6bf3c3f6bc5886e4dddf647a75a.zip | |
Keep resolve data in external hash table, rather than embedded defs
One step closer to removing fold and having a single, immutable AST.
Resolve still uses fold, because it has to detect and transform
expr_field expressions. If we go through on our plan of moving to a
different syntax for module dereferencing, the parser can spit out
expr_field expressions, and resolve can move to walk.
(I am truly sorry for the things I did in typestate_check.rs. I expect
we'll want to change that to walk as well in the near future, at which
point it should probably pass around a context record, which could
hold the def_map.)
Diffstat (limited to 'src/comp/front/eval.rs')
| -rw-r--r-- | src/comp/front/eval.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/comp/front/eval.rs b/src/comp/front/eval.rs index 1d708f17..c03e313d 100644 --- a/src/comp/front/eval.rs +++ b/src/comp/front/eval.rs @@ -34,7 +34,8 @@ type ctx = @rec(parser p, eval_mode mode, mutable vec[str] deps, session.session sess, - mutable uint chpos); + mutable uint chpos, + mutable uint next_ann); fn mk_env() -> env { let env e = vec(); @@ -113,7 +114,7 @@ fn eval_lit(ctx cx, span sp, @ast.lit lit) -> val { fn eval_expr(ctx cx, env e, @ast.expr x) -> val { alt (x.node) { - case (ast.expr_path(?pth, _, _)) { + case (ast.expr_path(?pth, _)) { if (Vec.len[ident](pth.node.idents) == 1u && Vec.len[@ast.ty](pth.node.types) == 0u) { ret lookup(cx.sess, e, x.span, pth.node.idents.(0)); @@ -383,12 +384,14 @@ fn eval_crate_directive(ctx cx, } auto start_id = cx.p.next_def_id(); - auto p0 = new_parser(cx.sess, e, start_id, full_path, cx.chpos); + auto p0 = new_parser(cx.sess, e, start_id, full_path, cx.chpos, + cx.next_ann); auto m0 = parse_mod_items(p0, token.EOF); auto next_id = p0.next_def_id(); // Thread defids and chpos through the parsers cx.p.set_def(next_id._1); cx.chpos = p0.get_chpos(); + cx.next_ann = p0.next_ann_num(); auto im = ast.item_mod(id, m0, next_id); auto i = @spanned(cdir.span.lo, cdir.span.hi, im); Vec.push[@ast.item](items, i); |