Skip to content

Commit 251b107

Browse files
committed
---
yaml --- r: 14179 b: refs/heads/try c: 7f1ea3e h: refs/heads/master i: 14177: 9445146 14175: e4eba97 v: v3
1 parent 7c7d434 commit 251b107

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
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: fe8a31e56992a712b532350596af05186ac90613
5+
refs/heads/try: 7f1ea3ef6a92eb82ae66c47954ed955eba6028b1
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/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);

branches/try/src/test/compile-fail/reference-in-loop.rs

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

branches/try/src/test/run-pass/reference-branch.rs

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

0 commit comments

Comments
 (0)