Skip to content

Commit cd9824d

Browse files
committed
---
yaml --- r: 55094 b: refs/heads/snap-stage3 c: 7033901 h: refs/heads/master v: v3
1 parent 8d2e0fc commit cd9824d

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 5f13e9ccc2e3328d4cd8ca49f84e6840dd998346
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 5119597dc6549e21d62ce7bae7b7418b3f8bf56e
4+
refs/heads/snap-stage3: 703390150a75abbe6fbacd6b6e3ae08c9a6f5e37
55
refs/heads/try: 8eb2bab100b42f0ba751552d8eff00eb2134c55a
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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)