about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2011-07-25 17:35:40 -0700
committerGraydon Hoare <graydon@mozilla.com>2011-07-25 17:35:40 -0700
commit5ab213a464710d8477fdaaae692fb79e1a91c1d6 (patch)
treea27ebf5423f62d57ab00d87f642c8acb96d0c682 /src/comp/syntax/parse
parentf639085a420084f44ce83f9a1d9c5e271017131f (diff)
downloadrust-5ab213a464710d8477fdaaae692fb79e1a91c1d6.tar.gz
rust-5ab213a464710d8477fdaaae692fb79e1a91c1d6.zip
Correct input coordinate tracking on block-opening brace.
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/parser.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index 6b616c909ab..cd082869c5d 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -821,7 +821,7 @@ fn parse_bottom_expr(&parser p) -> @ast::expr {
             expect(p, token::RBRACE);
             ex = ast::expr_rec(fields, base);
         } else {
-            auto blk = parse_block_tail(p);
+            auto blk = parse_block_tail(p, lo);
             ret mk_expr(p, blk.span.lo, blk.span.hi, ast::expr_block(blk));
         }
     } else if (eat_word(p, "if")) {
@@ -862,7 +862,7 @@ fn parse_bottom_expr(&parser p) -> @ast::expr {
         ret mk_mac_expr(p, lo, p.get_hi_pos(), ast::mac_embed_type(ty))
     } else if (p.peek() == token::POUND_LBRACE) {
         p.bump();
-        auto blk = ast::mac_embed_block(parse_block_tail(p));
+        auto blk = ast::mac_embed_block(parse_block_tail(p, lo));
         ret mk_mac_expr(p, lo, p.get_hi_pos(), blk);
     } else if (p.peek() == token::ELLIPSIS) {
         p.bump();
@@ -1755,13 +1755,13 @@ fn stmt_ends_with_semi(&ast::stmt stmt) -> bool {
 }
 
 fn parse_block(&parser p) -> ast::blk {
+    auto lo = p.get_lo_pos();
     expect(p, token::LBRACE);
-    be parse_block_tail(p);
+    be parse_block_tail(p, lo);
 }
 
 // some blocks start with "#{"...
-fn parse_block_tail(&parser p) -> ast::blk {
-    auto lo = p.get_lo_pos();
+fn parse_block_tail(&parser p, uint lo) -> ast::blk {
     let (@ast::stmt)[] stmts = ~[];
     let option::t[@ast::expr] expr = none;
     while (p.peek() != token::RBRACE) {