dart-lang / dart-lang/language

Support trailing commas in `<catchPart>`

Open
#3,672 5 comments 0 reactions 0 assignees View on GitHub
enhanced-syntax small-feature
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

For consistency, we could support a trailing comma in a ``:

```ebnf
::= 'catch' '(' (`,' )? ','? ')'
```

This proposal is a supplement to https://github.com/dart-lang/language/issues/1402 and https://github.com/dart-lang/language/issues/2430 where trailing commas are proposed in other syntactic positions.

NB: If we do support the trailing commas than the CFE should be adjusted to accept the trailing comma with a single identifier, and the analyzer should be adjusted to accept both. Conversely if we do not adopt this proposal then the CFE should be adjusted to reject the case with two identifiers. So we do need to do something in order to obtain a consistent treatment in both cases.

Contributor guide

Open the contributing guide

Research direction

Start with the proposed EBNF and the related issues 1402 and 2430 to understand the intended consistency. Then inspect how the CFE and analyzer handle a single identifier versus two identifiers in . Done means both components consistently accept or reject the trailing-comma cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.