Skip to content

Commit 5a81242

Browse files
bors[bot]matklad
andauthored
Merge #5560
5560: Fix nameref parsing r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents eb99c35 + b10e437 commit 5a81242

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

crates/ra_parser/src/grammar.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,6 @@ fn name_ref(p: &mut Parser) {
270270
let m = p.start();
271271
p.bump(IDENT);
272272
m.complete(p, NAME_REF);
273-
} else if p.at(T![self]) {
274-
let m = p.start();
275-
p.bump(T![self]);
276-
m.complete(p, T![self]);
277273
} else {
278274
p.err_and_bump("expected identifier");
279275
}

crates/ra_parser/src/grammar/items.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,13 @@ fn extern_crate_item(p: &mut Parser, m: Marker) {
304304
p.bump(T![extern]);
305305
assert!(p.at(T![crate]));
306306
p.bump(T![crate]);
307-
name_ref(p);
307+
308+
if p.at(T![self]) {
309+
p.bump(T![self]);
310+
} else {
311+
name_ref(p);
312+
}
313+
308314
opt_alias(p);
309315
p.expect(T![;]);
310316
m.complete(p, EXTERN_CRATE_ITEM);

crates/ra_syntax/test_data/parser/ok/0007_extern_crate.rast

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ [email protected]
2828
2929
3030
31-
32-
31+
3332
3433
3534

0 commit comments

Comments
 (0)