diff options
| author | Marmare314 <49279081+Marmare314@users.noreply.github.com> | 2023-04-16 14:34:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-16 14:34:57 +0200 |
| commit | 428c55b6eed3536bb228924c6fb0ad6cea6d6d4b (patch) | |
| tree | 22180a1cd0ed592e63f05486ea7d827fdc8b6621 /src/syntax/parser.rs | |
| parent | d2784f6f9040b280ce9930d8875b33fa034b7dd5 (diff) | |
refactor SyntaxKind::Pattern (#831)
Diffstat (limited to 'src/syntax/parser.rs')
| -rw-r--r-- | src/syntax/parser.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/syntax/parser.rs b/src/syntax/parser.rs index 7c05eebc..e6807404 100644 --- a/src/syntax/parser.rs +++ b/src/syntax/parser.rs @@ -839,7 +839,7 @@ fn args(p: &mut Parser) { } enum PatternKind { - Normal, + Ident, Destructuring, } @@ -849,18 +849,16 @@ fn pattern(p: &mut Parser) -> PatternKind { if p.at(SyntaxKind::LeftParen) { let kind = collection(p, false); validate_destruct_pattern(p, m); - p.wrap(m, SyntaxKind::Pattern); if kind == SyntaxKind::Parenthesized { - PatternKind::Normal + PatternKind::Ident } else { + p.wrap(m, SyntaxKind::Destructuring); PatternKind::Destructuring } } else { - if p.expect(SyntaxKind::Ident) { - p.wrap(m, SyntaxKind::Pattern); - } - PatternKind::Normal + p.expect(SyntaxKind::Ident); + PatternKind::Ident } } @@ -872,7 +870,7 @@ fn let_binding(p: &mut Parser) { let mut closure = false; let mut destructuring = false; match pattern(p) { - PatternKind::Normal => { + PatternKind::Ident => { closure = p.directly_at(SyntaxKind::LeftParen); if closure { let m3 = p.marker(); |
