Skip to content

Commit cd3c677

Browse files
committed
---
yaml --- r: 12669 b: refs/heads/master c: bde5a84 h: refs/heads/master i: 12667: 3d3d0a4 v: v3
1 parent ee1eb73 commit cd3c677

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
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: 8ab9efe262d20be8efc90535aeaf4ed9af47f400
2+
refs/heads/master: bde5a842ce286508e503694b2cac0251600e25be
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/librustsyntax/parse/parser.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,13 @@ fn parse_lit(p: parser) -> ast::lit {
508508
}
509509

510510
fn parse_path_without_tps(p: parser) -> @ast::path {
511+
parse_path_without_tps_(p, parse_ident, parse_ident)
512+
}
513+
514+
fn parse_path_without_tps_(
515+
p: parser, parse_ident: fn(parser) -> ast::ident,
516+
parse_last_ident: fn(parser) -> ast::ident) -> @ast::path {
517+
511518
let lo = p.span.lo;
512519
let global = eat(p, token::MOD_SEP);
513520
let mut ids = [];
@@ -516,10 +523,11 @@ fn parse_path_without_tps(p: parser) -> @ast::path {
516523
p.look_ahead(2u) != token::LT
517524
&& p.look_ahead(1u) == token::MOD_SEP;
518525

519-
ids += [parse_ident(p)];
520526
if is_not_last {
527+
ids += [parse_ident(p)];
521528
expect(p, token::MOD_SEP);
522529
} else {
530+
ids += [parse_last_ident(p)];
523531
break;
524532
}
525533
}
@@ -528,12 +536,7 @@ fn parse_path_without_tps(p: parser) -> @ast::path {
528536
}
529537

530538
fn parse_value_path(p: parser) -> @ast::path {
531-
let pt = parse_path_without_tps(p);
532-
let last_word = vec::last(pt.idents);
533-
if is_restricted_keyword(p, last_word) {
534-
p.fatal("found " + last_word + " in expression position");
535-
}
536-
pt
539+
parse_path_without_tps_(p, parse_ident, parse_value_ident)
537540
}
538541

539542
fn parse_path_with_tps(p: parser, colons: bool) -> @ast::path {

0 commit comments

Comments
 (0)