diff options
Diffstat (limited to 'crates/libsyntax2/src/grammar/params.rs')
-rw-r--r-- | crates/libsyntax2/src/grammar/params.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/grammar/params.rs b/crates/libsyntax2/src/grammar/params.rs index 5b1322b3a..bc0cb44ba 100644 --- a/crates/libsyntax2/src/grammar/params.rs +++ b/crates/libsyntax2/src/grammar/params.rs | |||
@@ -48,6 +48,10 @@ fn list_(p: &mut Parser, flavor: Flavor) { | |||
48 | opt_self_param(p); | 48 | opt_self_param(p); |
49 | } | 49 | } |
50 | while !p.at(EOF) && !p.at(ket) { | 50 | while !p.at(EOF) && !p.at(ket) { |
51 | if !VALUE_PARAMETER_FIRST.contains(p.current()) { | ||
52 | p.error("expected value parameter"); | ||
53 | break; | ||
54 | } | ||
51 | value_parameter(p, flavor); | 55 | value_parameter(p, flavor); |
52 | if !p.at(ket) { | 56 | if !p.at(ket) { |
53 | p.expect(COMMA); | 57 | p.expect(COMMA); |
@@ -57,6 +61,13 @@ fn list_(p: &mut Parser, flavor: Flavor) { | |||
57 | m.complete(p, PARAM_LIST); | 61 | m.complete(p, PARAM_LIST); |
58 | } | 62 | } |
59 | 63 | ||
64 | |||
65 | const VALUE_PARAMETER_FIRST: TokenSet = | ||
66 | token_set_union![ | ||
67 | patterns::PATTERN_FIRST, | ||
68 | types::TYPE_FIRST, | ||
69 | ]; | ||
70 | |||
60 | fn value_parameter(p: &mut Parser, flavor: Flavor) { | 71 | fn value_parameter(p: &mut Parser, flavor: Flavor) { |
61 | let m = p.start(); | 72 | let m = p.start(); |
62 | match flavor { | 73 | match flavor { |