aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/items.rs
diff options
context:
space:
mode:
authorcsmoe <[email protected]>2019-06-19 07:25:10 +0100
committercsmoe <[email protected]>2019-06-19 11:37:38 +0100
commitd04473accb1a22abdb2262d0e8954beaf28ae364 (patch)
tree4b4783e389168a39f9a930a30bfb29e1f883d237 /crates/ra_parser/src/grammar/items.rs
parentf7da575a98799aa2fffffe504d7fa4a314819c7c (diff)
fix: specialization(with blindly parsing)
Change-Id: Ic5d2767e8781568d76d4d0013cd6081e95ae8a95
Diffstat (limited to 'crates/ra_parser/src/grammar/items.rs')
-rw-r--r--crates/ra_parser/src/grammar/items.rs29
1 files changed, 28 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index e85147e9e..424d0476d 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -103,7 +103,21 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
103 p.bump_remap(T![auto]); 103 p.bump_remap(T![auto]);
104 has_mods = true; 104 has_mods = true;
105 } 105 }
106 if p.at(IDENT) && p.at_contextual_kw("default") && p.nth(1) == T![impl] { 106
107 if p.at(IDENT)
108 && p.at_contextual_kw("default")
109 && (match p.nth(1) {
110 T![impl] => true,
111 T![fn] | T![type] => {
112 if let ItemFlavor::Mod = flavor {
113 true
114 } else {
115 false
116 }
117 }
118 _ => false,
119 })
120 {
107 p.bump_remap(T![default]); 121 p.bump_remap(T![default]);
108 has_mods = true; 122 has_mods = true;
109 } 123 }
@@ -163,12 +177,25 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
163 // test default_impl 177 // test default_impl
164 // default impl Foo {} 178 // default impl Foo {}
165 179
180 // test_err default_fn_type
181 // trait T {
182 // default type T = Bar;
183 // default fn foo() {}
184 // }
185
186 // test default_fn_type
187 // impl T for Foo {
188 // default type T = Bar;
189 // default fn foo() {}
190 // }
191
166 // test unsafe_default_impl 192 // test unsafe_default_impl
167 // unsafe default impl Foo {} 193 // unsafe default impl Foo {}
168 T![impl] => { 194 T![impl] => {
169 traits::impl_block(p); 195 traits::impl_block(p);
170 m.complete(p, IMPL_BLOCK); 196 m.complete(p, IMPL_BLOCK);
171 } 197 }
198
172 // test existential_type 199 // test existential_type
173 // existential type Foo: Fn() -> usize; 200 // existential type Foo: Fn() -> usize;
174 T![type] => { 201 T![type] => {