Simplify AST for expr_anon_obj.

This commit is contained in:
Lindsey Kuper 2011-07-06 11:29:22 -07:00
parent 23bae67f4c
commit e30d2c82ae
10 changed files with 13 additions and 15 deletions

View file

@ -296,7 +296,7 @@ tag expr_ {
expr_if_check(@expr, block, option::t[@expr]);
expr_port(option::t[@ty]);
expr_chan(@expr);
expr_anon_obj(anon_obj, vec[ty_param], obj_def_ids);
expr_anon_obj(anon_obj, vec[ty_param]);
}
type lit = spanned[lit_];

View file

@ -429,8 +429,8 @@ fn noop_fold_expr(&expr_ e, ast_fold fld) -> expr_ {
})
}
case (expr_chan(?e)) { expr_chan(fld.fold_expr(e)) }
case (expr_anon_obj(?ao, ?typms, ?odis)) {
expr_anon_obj(fold_anon_obj(ao), typms, odis)
case (expr_anon_obj(?ao, ?typms)) {
expr_anon_obj(fold_anon_obj(ao), typms)
}
}
}

View file

@ -801,8 +801,7 @@ fn parse_bottom_expr(&parser p) -> @ast::expr {
// "spanned".
let ast::anon_obj ob =
rec(fields=fields, methods=meths, with_obj=with_obj);
auto odid = rec(ty=p.get_id(), ctor=p.get_id());
ex = ast::expr_anon_obj(ob, ty_params, odid);
ex = ast::expr_anon_obj(ob, ty_params);
} else if (eat_word(p, "rec")) {
expect(p, token::LPAREN);
auto fields = [parse_field(p)];
@ -1592,7 +1591,7 @@ fn stmt_ends_with_semi(&ast::stmt stmt) -> bool {
case (ast::expr_if_check(_, _, _)) { false }
case (ast::expr_port(_)) { true }
case (ast::expr_chan(_)) { true }
case (ast::expr_anon_obj(_,_,_)) { false }
case (ast::expr_anon_obj(_,_)) { false }
case (ast::expr_assert(_)) { true }
}
}

View file

@ -953,7 +953,7 @@ fn print_expr(&ps s, &@ast::expr expr) {
print_expr(s, expr);
pclose(s);
}
case (ast::expr_anon_obj(_, _, _)) {
case (ast::expr_anon_obj(_, _)) {
word(s.s, "anon obj");
// FIXME (issue #499): nicer pretty-printing of anon objs

View file

@ -371,7 +371,7 @@ fn visit_expr[E](&@expr ex, &E e, &vt[E] v) {
case (expr_assert(?x)) { vt(v).visit_expr(x, e, v); }
case (expr_port(_)) { }
case (expr_chan(?x)) { vt(v).visit_expr(x, e, v); }
case (expr_anon_obj(?anon_obj, _, _)) {
case (expr_anon_obj(?anon_obj, _)) {
alt (anon_obj.fields) {
case (none) { }
case (some(?fields)) {

View file

@ -380,7 +380,7 @@ fn walk_expr(&ast_visitor v, @ast::expr e) {
case (ast::expr_assert(?x)) { walk_expr(v, x); }
case (ast::expr_port(_)) { }
case (ast::expr_chan(?x)) { walk_expr(v, x); }
case (ast::expr_anon_obj(?anon_obj, _, _)) {
case (ast::expr_anon_obj(?anon_obj, _)) {
// Fields
alt (anon_obj.fields) {