Skip to content

Commit 8db9633

Browse files
committed
---
yaml --- r: 140165 b: refs/heads/try2 c: 7033901 h: refs/heads/master i: 140163: fb1f0be v: v3
1 parent dbf7fdf commit 8db9633

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 5119597dc6549e21d62ce7bae7b7418b3f8bf56e
8+
refs/heads/try2: 703390150a75abbe6fbacd6b6e3ae08c9a6f5e37
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libsyntax/parse/parser.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2359,14 +2359,13 @@ pub impl Parser {
23592359
}
23602360
_ => {
23612361
let mut args: ~[@pat] = ~[];
2362-
let mut star_pat = false;
23632362
match *self.token {
23642363
token::LPAREN => match self.look_ahead(1u) {
23652364
token::BINOP(token::STAR) => {
23662365
// This is a "top constructor only" pat
23672366
self.bump(); self.bump();
2368-
star_pat = true;
23692367
self.expect(&token::RPAREN);
2368+
pat = pat_enum(enum_path, None);
23702369
}
23712370
_ => {
23722371
args = self.parse_unspanned_seq(
@@ -2377,23 +2376,21 @@ pub impl Parser {
23772376
),
23782377
|p| p.parse_pat(refutable)
23792378
);
2379+
pat = pat_enum(enum_path, Some(args));
23802380
}
23812381
},
2382-
_ => ()
2383-
}
2384-
// at this point, we're not sure whether it's a
2385-
// enum or a bind
2386-
if star_pat {
2387-
pat = pat_enum(enum_path, None);
2388-
}
2389-
else if vec::is_empty(args) &&
2390-
vec::len(enum_path.idents) == 1u {
2391-
pat = pat_ident(binding_mode,
2392-
enum_path,
2393-
None);
2394-
}
2395-
else {
2396-
pat = pat_enum(enum_path, Some(args));
2382+
_ => {
2383+
if vec::len(enum_path.idents)==1u {
2384+
// it could still be either an enum
2385+
// or an identifier pattern, resolve
2386+
// will sort it out:
2387+
pat = pat_ident(binding_mode,
2388+
enum_path,
2389+
None);
2390+
} else {
2391+
pat = pat_enum(enum_path, Some(args));
2392+
}
2393+
}
23972394
}
23982395
}
23992396
}

0 commit comments

Comments
 (0)