diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-10 14:01:44 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-10 14:01:44 +0100 |
commit | 9d3c78e2eee6635772c99d7351b621cefb08bac5 (patch) | |
tree | 14e74b81c7195bcd5b308e799c3fd447e76274ca /crates/ra_parser/src/grammar/params.rs | |
parent | e2ebb467bdf3ebb7d29260adb95c56594c6db282 (diff) | |
parent | ed726081d1df2fb6a1c21101996dcae203f79021 (diff) |
Merge #1801
1801: WIP: switch to fully decomposed tokens internally r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_parser/src/grammar/params.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/params.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crates/ra_parser/src/grammar/params.rs b/crates/ra_parser/src/grammar/params.rs index 56e457325..5893b22fd 100644 --- a/crates/ra_parser/src/grammar/params.rs +++ b/crates/ra_parser/src/grammar/params.rs | |||
@@ -80,7 +80,7 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) { | |||
80 | match flavor { | 80 | match flavor { |
81 | Flavor::OptionalType | Flavor::Normal => { | 81 | Flavor::OptionalType | Flavor::Normal => { |
82 | patterns::pattern(p); | 82 | patterns::pattern(p); |
83 | if p.at(T![:]) || flavor.type_required() { | 83 | if p.at(T![:]) && !p.at(T![::]) || flavor.type_required() { |
84 | types::ascription(p) | 84 | types::ascription(p) |
85 | } | 85 | } |
86 | } | 86 | } |
@@ -96,10 +96,11 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) { | |||
96 | // trait Foo { | 96 | // trait Foo { |
97 | // fn bar(_: u64, mut x: i32); | 97 | // fn bar(_: u64, mut x: i32); |
98 | // } | 98 | // } |
99 | if (la0 == IDENT || la0 == T![_]) && la1 == T![:] | 99 | if (la0 == IDENT || la0 == T![_]) && la1 == T![:] && !p.nth_at(1, T![::]) |
100 | || la0 == T![mut] && la1 == IDENT && la2 == T![:] | 100 | || la0 == T![mut] && la1 == IDENT && la2 == T![:] |
101 | || la0 == T![&] && la1 == IDENT && la2 == T![:] | 101 | || la0 == T![&] |
102 | || la0 == T![&] && la1 == T![mut] && la2 == IDENT && la3 == T![:] | 102 | && (la1 == IDENT && la2 == T![:] && !p.nth_at(2, T![::]) |
103 | || la1 == T![mut] && la2 == IDENT && la3 == T![:] && !p.nth_at(3, T![::])) | ||
103 | { | 104 | { |
104 | patterns::pattern(p); | 105 | patterns::pattern(p); |
105 | types::ascription(p); | 106 | types::ascription(p); |