diff options
| author | Graydon Hoare <[email protected]> | 2011-03-01 17:32:16 -0800 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-03-01 17:33:17 -0800 |
| commit | 64ab5eaaf09de6a75392554c13784c492ed19465 (patch) | |
| tree | 2c166a5924fcae5971dad486f42cc25d913c6d95 /src/comp/front/parser.rs | |
| parent | rustc: Remove the static "size" field from the tag info (diff) | |
| download | rust-64ab5eaaf09de6a75392554c13784c492ed19465.tar.xz rust-64ab5eaaf09de6a75392554c13784c492ed19465.zip | |
Parse (and ignore) dtors on objs.
Diffstat (limited to 'src/comp/front/parser.rs')
| -rw-r--r-- | src/comp/front/parser.rs | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 696140b1..f747c084 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -1715,21 +1715,33 @@ impure fn parse_item_obj(parser p, ast.layer lyr) -> @ast.item { some(token.COMMA), pf, p); - auto pm = parse_method; - let util.common.spanned[vec[@ast.method]] meths = - parse_seq[@ast.method] - (token.LBRACE, - token.RBRACE, - none[token.token], - pm, p); + let vec[@ast.method] meths = vec(); + let option.t[ast.block] dtor = none[ast.block]; + + expect(p, token.LBRACE); + while (p.peek() != token.RBRACE) { + alt (p.peek()) { + case (token.DROP) { + p.bump(); + dtor = some[ast.block](parse_block(p)); + } + case (_) { + append[@ast.method](meths, + parse_method(p)); + } + } + } + auto hi = p.get_span(); + expect(p, token.RBRACE); let ast._obj ob = rec(fields=fields.node, - methods=meths.node); + methods=meths, + dtor=dtor); auto item = ast.item_obj(ident, ob, ty_params, p.next_def_id(), ast.ann_none); - ret @spanned(lo, meths.span, item); + ret @spanned(lo, hi, item); } impure fn parse_mod_items(parser p, token.token term) -> ast._mod { |