File tree 1 file changed +6
-9
lines changed
crates/parser/src/grammar
1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -223,20 +223,16 @@ fn record_pat_field(p: &mut Parser) {
223
223
p. bump ( T ! [ : ] ) ;
224
224
pattern ( p) ;
225
225
}
226
- T ! [ . ] => {
227
- if p. at ( T ! [ ..] ) {
228
- p. bump ( T ! [ ..] ) ;
229
- } else {
230
- ident_pat ( p, false ) ;
231
- }
232
- }
233
226
T ! [ box] => {
234
227
// FIXME: not all box patterns should be allowed
235
228
box_pat ( p) ;
236
229
}
237
- _ => {
230
+ T ! [ ref ] | T ! [ mut ] | IDENT => {
238
231
ident_pat ( p, false ) ;
239
232
}
233
+ _ => {
234
+ p. err_and_bump ( "expected identifier" ) ;
235
+ }
240
236
}
241
237
}
242
238
@@ -405,10 +401,11 @@ fn pat_list(p: &mut Parser, ket: SyntaxKind) {
405
401
// let ref mut f @ g @ _ = ();
406
402
// }
407
403
fn ident_pat ( p : & mut Parser , with_at : bool ) -> CompletedMarker {
404
+ assert ! ( matches!( p. current( ) , T ![ ref] | T ![ mut ] | IDENT ) ) ;
408
405
let m = p. start ( ) ;
409
406
p. eat ( T ! [ ref] ) ;
410
407
p. eat ( T ! [ mut ] ) ;
411
- name ( p ) ;
408
+ name_r ( p , PAT_RECOVERY_SET ) ;
412
409
if with_at && p. eat ( T ! [ @] ) {
413
410
pattern_single ( p) ;
414
411
}
You can’t perform that action at this time.
0 commit comments