-
Notifications
You must be signed in to change notification settings - Fork 477
Refactor array bracket access to dedicated AST node #8168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Hmm, any reason you went with one new node to represent two different things? |
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
I had it split initially, but thought it would be better to represent this as a single node to be consistent with record update. | Pexp_record of expression record_element list * expression option
(* { l1=P1; ...; ln=Pn } (None)
{ E0 with l1=P1; ...; ln=Pn } (Some E0) *)but, you could also make a counter argument with Splitting |
|
This is not currently changing the parser. Guess wip. Just, it means it's not been tested yet. |
It was just my initial unfiltered response. With records it feels different somehow: |
|
Okay this is probably closer to record construction vs mutable record field assignment (two different nodes) rather than record update. This is still in draft though, it is still subject to change and I don't mind changing it to two different nodes. |
|
I also think 2 separate nodes are cleaner for this. Great work btw, this will be a good cleanup/enhancement. |
Refactors array bracket access from
Pexp_apply(Array.get/set, ...)to a dedicatedPexp_indexAST node. This is an internal refactoring with no user-facing changes.Changes:
arr[0]now represented asPexp_index(arr, 0, None)in ASTarr[0] = valnow represented asPexp_index(arr, 0, Some(val))in ASTWhy: