Open bathos opened 4 years ago
On reflection I think maybe some of these omissions are sensible because they aren’t cases where ASI would successfully apply. It’s unclear to me whether the definition of restricted production is ‘a production that includes [no LineTerminator here]’ or if it is ‘a production that includes [no LineTerminator here] where, if a line terminator did occur in that position, ASI would produce a valid result.’
In any case, some of the omitted items do fall within the latter, narrower category, e.g. AsyncFunctionDeclaration.
Edit: The term "restricted production" is defined explicitly and it does appear to include all 16:
If the phrase “[no LineTerminator here]” appears in the right-hand side of a production of the syntactic grammar, it indicates that the production is a restricted production: it may not be used if a LineTerminator occurs in the input stream at the indicated position.
Thanks. The note that I’m talking about is left unchanged by that PR I think — it still says ‘the following are the only...’ but then doesn’t actually list all of them.
I’ll try my hand at a PR to revise this text, though I’d like to know first which of the following makes more sense to people:
Updating the list to be comprehensive was the desired goal of #1193; that seems to be the proper path.
In Rules of Automatic Semicolon Insertion, there’s a note which begins “The following are the only restricted productions in the grammar.” It then lists seven of the sixteen restricted productions. The missing ones are:
I’m not sure it’s practical to list all of them. I think maybe the note ought to be removed or reworked so that it’s illustrative rather than (supposedly) comprehensive.
The productions repeated here are also inconsistent: some include their alternatives that don’t use NLTH, while others omit them.