Skip to content

Commit c8b4ec6

Browse files
lkupergraydon
authored andcommitted
---
yaml --- r: 2528 b: refs/heads/master c: d3242b9 h: refs/heads/master v: v3
1 parent 5d62f23 commit c8b4ec6

File tree

5 files changed

+26
-22
lines changed

5 files changed

+26
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 6c1c5b39482158f078b5b10164c024edf345e386
2+
refs/heads/master: d3242b9644bb32f9a74be845518067566e2f36a7

trunk/src/comp/front/ast.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -379,18 +379,6 @@ type anon_obj = rec(
379379
// with_obj: the original object being extended, if it exists.
380380
Option.t[ident] with_obj);
381381

382-
tag mod_index_entry {
383-
mie_view_item(@view_item);
384-
mie_item(@item);
385-
mie_tag_variant(@item /* tag item */, uint /* variant index */);
386-
}
387-
388-
tag native_mod_index_entry {
389-
nmie_view_item(@view_item);
390-
nmie_item(@native_item);
391-
}
392-
393-
type mod_index = hashmap[ident,mod_index_entry];
394382
type _mod = rec(vec[@view_item] view_items,
395383
vec[@item] items);
396384

trunk/src/comp/front/parser.rs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -806,26 +806,40 @@ fn parse_bottom_expr(parser p) -> @ast::expr {
806806
auto ty_params = parse_ty_params(p);
807807

808808
// Only make people type () if they're actually adding new fields
809-
let option.t[vec[ast.obj_field]] fields = none[vec[ast.obj_field]];
809+
let option.t[vec[ast::obj_field]] fields = none[vec[ast::obj_field]];
810810
if (p.peek() == token::LPAREN) {
811811
auto pf = parse_obj_field;
812+
expect(p, token::LBRACE);
813+
while (p.peek() != token::RBRACE) {
814+
alt (p.peek()) {
815+
case (token.WITH) {
816+
p.bump();
817+
with_obj = some[ast::ident](parse_ident(p));
818+
}
819+
case (_) {
820+
Vec.push[@ast::method](meths,
821+
parse_method(p));
822+
}
823+
}
824+
}
825+
812826
hi = p.get_hi_pos();
813827
expect(p, token::LPAREN);
814-
fields = some[vec[ast.obj_field]]
815-
(parse_seq_to_end[ast.obj_field]
828+
fields = some[vec[ast::obj_field]]
829+
(parse_seq_to_end[ast::obj_field]
816830
(token::RPAREN,
817831
some(token::COMMA),
818832
pf, hi, p));
819833
}
820834

821-
let vec[@ast.method] meths = vec();
822-
let option.t[ast.ident] with_obj = none[ast.ident];
835+
let vec[@ast::method] meths = vec();
836+
let option.t[ast::ident] with_obj = none[ast::ident];
823837

824838
expect(p, token::LBRACE);
825839
while (p.peek() != token::RBRACE) {
826840
alt (p.peek()) {
827841
case (token::WITH) {
828-
with_obj = some[ast.ident](parse_ident(p));
842+
with_obj = some[ast::ident](parse_ident(p));
829843
}
830844
case (_) {
831845
// fall through
@@ -841,13 +855,13 @@ fn parse_bottom_expr(parser p) -> @ast::expr {
841855

842856
// We don't need to pull ".node" out of fields because it's not a
843857
// "spanned".
844-
let ast.anon_obj ob = rec(fields=fields,
858+
let ast::anon_obj ob = rec(fields=fields,
845859
methods=meths,
846860
with_obj=with_obj);
847861

848862
auto odid = rec(ty=p.next_def_id(), ctor=p.next_def_id());
849863

850-
ex = ast.expr_anon_obj(ob, ty_params, odid, ast.ann_none);
864+
ex = ast::expr_anon_obj(ob, ty_params, odid, ast::ann_none);
851865

852866
} else if (eat_word(p, "bind")) {
853867
auto e = parse_expr_res(p, RESTRICT_NO_CALL_EXPRS);

trunk/src/comp/middle/walk.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,8 @@ fn walk_expr(&ast_visitor v, @ast::expr e) {
433433
case (ast::expr_chan(?x, _)) {
434434
walk_expr(v, x);
435435
}
436+
437+
case (ast.expr_anon_obj(_,_,_,_)) { }
436438
}
437439
v.visit_expr_post(e);
438440
}

trunk/src/test/run-pass/method-overriding.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn main() {
2424
};
2525

2626
// Extending an object with a new field
27-
auto my_c = obj(quux) { with my_a } ;
27+
auto my_c = obj(int quux) { with my_a } ;
2828

2929
// Should this be legal?
3030
auto my_d = obj() { with my_a } ;

0 commit comments

Comments
 (0)