The first bullet names its construct “switch statement”, the second uses the rule name, “is-pattern”, while the third does both, “switch expression” & ”switch-expression”. Maybe use one style consistently? Given the second bullet I might go with the rule names:
- In a *switch_statement*, the *pattern* of a *switch_label* is tested against the *selector_expression* of the *switch_statement*.
- With an *is-pattern* operator, the *pattern* on the right-hand-side is tested against the expression on the left.
- In a *switch_expression*, the *pattern* of a *switch_expression_arm* is tested against the expression on the *switch_expression*’s left-hand-side.
- In nested contexts, the *sub-pattern* is tested against values retrieved from properties, fields, or indexed from other input values, depending on the pattern form.
Yes, I left two occurrences of “expression” as in both cases expression is technically wrong but the actual rule name would I think be unhelpful.
Feel free to wordsmith better options!
Originally posted by @Nigel-Ecma in #873 (comment)
The first bullet names its construct “switch statement”, the second uses the rule name, “is-pattern”, while the third does both, “switch expression” & ”switch-expression”. Maybe use one style consistently? Given the second bullet I might go with the rule names:
Yes, I left two occurrences of “expression” as in both cases expression is technically wrong but the actual rule name would I think be unhelpful.
Feel free to wordsmith better options!
Originally posted by @Nigel-Ecma in #873 (comment)