Skip to content

Commit 10c8e11

Browse files
committed
---
yaml --- r: 11173 b: refs/heads/master c: 7f1ea3e h: refs/heads/master i: 11171: ab1562b v: v3
1 parent 76ea339 commit 10c8e11

File tree

4 files changed

+15
-25
lines changed

4 files changed

+15
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: fe8a31e56992a712b532350596af05186ac90613
2+
refs/heads/master: 7f1ea3ef6a92eb82ae66c47954ed955eba6028b1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/comp/syntax/parse/parser.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,15 @@ fn parse_path(p: parser) -> @ast::path {
666666
{global: global, idents: ids, types: []});
667667
}
668668

669+
fn parse_value_path(p: parser) -> @ast::path {
670+
let pt = parse_path(p);
671+
let last_word = pt.node.idents[vec::len(pt.node.idents)-1u];
672+
if p.bad_expr_words.contains_key(last_word) {
673+
p.fatal("found " + last_word + " in expression position");
674+
}
675+
pt
676+
}
677+
669678
fn parse_path_and_ty_param_substs(p: parser, colons: bool) -> @ast::path {
670679
let lo = p.span.lo;
671680
let path = parse_path(p);
@@ -1510,11 +1519,11 @@ fn parse_pat(p: parser) -> @ast::pat {
15101519
pat = ast::pat_lit(val);
15111520
}
15121521
} else if is_plain_ident(p) &&
1513-
alt p.look_ahead(1u) {
1514-
token::LPAREN | token::LBRACKET | token::LT { false }
1515-
_ { true }
1516-
} {
1517-
let name = parse_path(p);
1522+
alt p.look_ahead(1u) {
1523+
token::LPAREN | token::LBRACKET | token::LT { false }
1524+
_ { true }
1525+
} {
1526+
let name = parse_value_path(p);
15181527
let sub = if eat(p, token::AT) { some(parse_pat(p)) }
15191528
else { none };
15201529
pat = ast::pat_ident(name, sub);

trunk/src/test/compile-fail/reference-in-loop.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

trunk/src/test/run-pass/reference-branch.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)