-
Notifications
You must be signed in to change notification settings - Fork 38
Dropped annotations from punned record labels. #584
Conversation
5b60f01
to
d76a32f
Compare
@@ -2674,6 +2676,7 @@ and parseJsxChildren p = | |||
and parseBracedOrRecordExpr p = | |||
let startPos = p.Parser.startPos in | |||
Parser.expect Lbrace p; | |||
let attrsForFields = parseAttributesForFields p in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very close to surface syntax.
e8aa6b0
to
949a7b9
Compare
@@ -6250,9 +6263,29 @@ and parseAttribute p = | |||
] ) | |||
| _ -> None | |||
|
|||
and parseAttributeForFields p = | |||
let isAttributeForField p = | |||
Parser.lookahead p (function state -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the grammar forces us into using a lookahead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's super overloaded over there. Apparently {JSX stufff}
only works because the JSX
attribute drives the parser into a specific path (which does not consider records). Which itself is arbitrary.
I'm thinking of considering proper surface syntax early on, so one does not need to distinguish based on the name of attributes, which is really not robust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this PR, it already distinguished based on the presence of attributes, which is also unclear whether intended.
Add examples of expression and patterns showing where they are dropped.
Support all the cases discussed in #583