Capture a decision about highlighting new

We made a decision about how to handle the `new` keyword in various
locations, and I thought it would be good to capture that decision.

Change-Id: I28373128955444dc09ad44c3fdab209020cc0bc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/487180
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson
2026-03-11 12:02:22 -07:00
committed by Commit Queue
parent 04f58e64f6
commit 7fe34af78c
@@ -33,6 +33,16 @@ keyword and identifiers that are not. As a result, we treat all of these as
keywords whenever they serve the function of a keyword, and treat them as
identifiers when they don't.
#### The `new` keyword in constructor declarations
For the case where the `new` is introducing a constructor, it's acting as a
keyword, similar to `class`, that indicates that what follows is a constructor
declaration.
For the case where `.new` follows a class name, it's not acting as a keyword,
but as an alternative to omitting the name. In those cases it should be
highlighted as an identifier.
## Semantic highlighting
Semantic highlighting covers highlighting that is dependent on knowing the