Repository navigation
Conversation
crisbeto
force-pushed
the
binary-assignments
branch
from
May 26, 2025 12:23
6a0173d to
b8b4b4c
Compare
Member
Author
crisbeto
marked this pull request as ready for review
May 26, 2025 15:41
Member
Author
|
Caretaker note: cl/763441006 will have to be patched in together with these changes. |
crisbeto
force-pushed
the
binary-assignments
branch
3 times, most recently
from
May 31, 2025 05:13
7d5f5ef to
339a682
Compare
…rite ones Currently our expression parser produces two different expressions for writes: `PropertyWrite` (e.g. `foo.bar = 123`) or `KeyedWrite` (e.g. `foo[0] = 123`). This is inconsistent with other ASTs, like TypeScript's, where writes are represented as binary expressions with a `=` operator and it makes it difficult to implement more write operators like `??=`, because we'd essentially have to duplicate them. These changes switch the expression parser over to produce binary expressions instead.
Reworks the places that were depending on `PropertyWrite` and `KeyedWrite` to account for the new AST structure.
Similarly to the previous change to the expression AST, these changes replace the `WriteVarExpr`, `WriteKeyExpr` and `WritePropExpr` from the output AST with a binary expression. This is closer aligned to TypeScript and makes it easier to translate code between the two.
crisbeto
force-pushed
the
binary-assignments
branch
from
June 2, 2025 13:59
339a682 to
dc23d22
Compare
Contributor
|
This PR was merged into the repository by commit b1f3d2e. The changes were merged into the following branches: main |
kirjs
pushed a commit
that referenced
this pull request
Jun 3, 2025
Reworks the places that were depending on `PropertyWrite` and `KeyedWrite` to account for the new AST structure. PR Close #61682
kirjs
pushed a commit
that referenced
this pull request
Jun 3, 2025
Similarly to the previous change to the expression AST, these changes replace the `WriteVarExpr`, `WriteKeyExpr` and `WritePropExpr` from the output AST with a binary expression. This is closer aligned to TypeScript and makes it easier to translate code between the two. PR Close #61682
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Includes a few changes aimed at aligning how we represent assignments in our expression and output AST to how TypeScript does it. This both simplifies the code and makes it easier to ship other operators like
??=in the future. Summary:refactor(compiler): produce binary expressions instead of dedicated write ones
Currently our expression parser produces two different expressions for writes:
PropertyWrite(e.g.foo.bar = 123) orKeyedWrite(e.g.foo[0] = 123). This is inconsistent with other ASTs, like TypeScript's, where writes are represented as binary expressions with a=operator and it makes it difficult to implement more write operators like??=, because we'd essentially have to duplicate them.These changes switch the expression parser over to produce binary expressions instead.
refactor(compiler): account for new assignment AST
Reworks the places that were depending on
PropertyWriteandKeyedWriteto account for the new AST structure.refactor(compiler): replace output AST write nodes
Similarly to the previous change to the expression AST, these changes replace the
WriteVarExpr,WriteKeyExprandWritePropExprfrom the output AST with a binary expression. This is closer aligned to TypeScript and makes it easier to translate code between the two.