diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-01-25 16:23:43 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-01-25 16:24:06 -0800 |
| commit | 2999479a2dcb10019558d64c2045fdee31841d31 (patch) | |
| tree | 331200932427d412f7d406d992212f91cea564dc /src/comp/syntax/parse/parser.rs | |
| parent | 08c6cb5f708efa7484ca27d6b14b86d6ae58b692 (diff) | |
| download | rust-2999479a2dcb10019558d64c2045fdee31841d31.tar.gz rust-2999479a2dcb10019558d64c2045fdee31841d31.zip | |
rustc: Allow attributes on enum variants. Closes #1663
Diffstat (limited to 'src/comp/syntax/parse/parser.rs')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 4d8acc6fa44..a66b223175c 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -2042,6 +2042,7 @@ fn parse_item_enum(p: parser, attrs: [ast::attribute]) -> @ast::item { let variant = spanned(ty.span.lo, ty.span.hi, {name: id, + attrs: [], args: [{ty: ty, id: p.get_id()}], id: p.get_id(), disr_expr: none}); @@ -2049,9 +2050,11 @@ fn parse_item_enum(p: parser, attrs: [ast::attribute]) -> @ast::item { ast::item_enum([variant], ty_params), attrs); } expect(p, token::LBRACE); + let all_nullary = true, have_disr = false; while p.token != token::RBRACE { + let variant_attrs = parse_outer_attributes(p); let vlo = p.span.lo; let ident = parse_value_ident(p); let args = [], disr_expr = none; @@ -2068,7 +2071,8 @@ fn parse_item_enum(p: parser, attrs: [ast::attribute]) -> @ast::item { disr_expr = some(parse_expr(p)); } - let vr = {name: ident, args: args, id: p.get_id(), + let vr = {name: ident, attrs: variant_attrs, + args: args, id: p.get_id(), disr_expr: disr_expr}; variants += [spanned(vlo, p.last_span.hi, vr)]; |
