Obliterate the callee_id hack
Exprs that could be applications of overloaded operators (expr_unary, expr_binary, expr_index) relied on the previous node ID being "reserved" to carry extra typechecking info. This was incredibly error-prone. Fixed it; now all exprs have two node IDs (which will be wasted in some cases; future work could make this an option instead if the extra int field ends up being a performance problem). Closes #2804
This commit is contained in:
parent
fec8059ed5
commit
78ec6fe30c
21 changed files with 148 additions and 57 deletions
|
@ -3,12 +3,13 @@ import base::ext_ctxt;
|
|||
|
||||
fn mk_expr(cx: ext_ctxt, sp: codemap::span, expr: ast::expr_) ->
|
||||
@ast::expr {
|
||||
ret @{id: cx.next_id(), node: expr, span: sp};
|
||||
ret @{id: cx.next_id(), callee_id: cx.next_id(),
|
||||
node: expr, span: sp};
|
||||
}
|
||||
|
||||
fn mk_lit(cx: ext_ctxt, sp: span, lit: ast::lit_) -> @ast::expr {
|
||||
let sp_lit = @{node: lit, span: sp};
|
||||
ret @{id: cx.next_id(), node: ast::expr_lit(sp_lit), span: sp};
|
||||
mk_expr(cx, sp, ast::expr_lit(sp_lit))
|
||||
}
|
||||
fn mk_str(cx: ext_ctxt, sp: span, s: str) -> @ast::expr {
|
||||
let lit = ast::lit_str(@s);
|
||||
|
@ -62,7 +63,7 @@ fn mk_call(cx: ext_ctxt, sp: span, fn_path: ~[ast::ident],
|
|||
fn mk_base_vec_e(cx: ext_ctxt, sp: span, exprs: ~[@ast::expr]) ->
|
||||
@ast::expr {
|
||||
let vecexpr = ast::expr_vec(exprs, ast::m_imm);
|
||||
ret @{id: cx.next_id(), node: vecexpr, span: sp};
|
||||
mk_expr(cx, sp, vecexpr)
|
||||
}
|
||||
fn mk_vstore_e(cx: ext_ctxt, sp: span, expr: @ast::expr, vst: ast::vstore) ->
|
||||
@ast::expr {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue