diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2011-05-30 15:56:01 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-05-31 11:00:47 -0700 |
| commit | b48cab962a08e370af523d082ef8946dfcfd3059 (patch) | |
| tree | 24e7ca85c92746e5d92f84cacb972c4b0d83ce27 /src/comp/front | |
| parent | d12ea3989649616437a7c1434f5c5a6438235eb7 (diff) | |
Add span to field to catch per-field comments in rec exprs.
Diffstat (limited to 'src/comp/front')
| -rw-r--r-- | src/comp/front/ast.rs | 3 | ||||
| -rw-r--r-- | src/comp/front/extfmt.rs | 6 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 3 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index 83d6e6bc1ff..55ef2211774 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -229,7 +229,8 @@ tag decl_ { type arm = rec(@pat pat, block block); type elt = rec(mutability mut, @expr expr); -type field = rec(mutability mut, ident ident, @expr expr); +type field_ = rec(mutability mut, ident ident, @expr expr); +type field = spanned[field_]; tag spawn_dom { dom_implicit; diff --git a/src/comp/front/extfmt.rs b/src/comp/front/extfmt.rs index cb8ca4f6ce0..f6ad1d04a39 100644 --- a/src/comp/front/extfmt.rs +++ b/src/comp/front/extfmt.rs @@ -148,9 +148,9 @@ fn pieces_to_expr(parser p, vec[piece] pieces, vec[@ast::expr] args) for (tup(ast::ident, @ast::expr) field in fields) { auto ident = field._0; auto val = field._1; - auto astfield = rec(mut = ast::imm, - ident = ident, - expr = val); + auto astfield = rec(node=rec(mut = ast::imm, + ident = ident, + expr = val), span=sp); astfields += [astfield]; } diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 803d75250ac..a6d8560ee67 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -737,11 +737,12 @@ fn parse_mutability(&parser p) -> ast::mutability { } fn parse_field(&parser p) -> ast::field { + auto lo = p.get_lo_pos(); auto m = parse_mutability(p); auto i = parse_ident(p); expect(p, token::EQ); auto e = parse_expr(p); - ret rec(mut=m, ident=i, expr=e); + ret spanned(lo, e.span.hi, rec(mut=m, ident=i, expr=e)); } fn parse_bottom_expr(&parser p) -> @ast::expr { |
