Skip to content

Port es2021 transform #1372

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

Merged
merged 1 commit into from
Jul 8, 2025
Merged

Port es2021 transform #1372

merged 1 commit into from
Jul 8, 2025

Conversation

weswigham
Copy link
Member

Which is just the logical assignment operators - &&=, ||=, and ??=.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ports the ES2021 logical assignment operators (&&=, ||=, ??=) into the compiler’s transform pipeline, refactors shared utilities for expression handling, and updates the emitted JavaScript baselines across multiple compilation targets.

  • Introduces a new IsSimpleCopiableExpression helper to decide when to inline expressions without temp variables.
  • Refactors the module transformer to use the shared “simple copiable” utility and removes duplication.
  • Implements a logicalAssignmentTransformer that rewrites x &&= y (and friends) into x && (x = y) when downleveling.
  • Updates dozens of test baseline files to reflect the new transform output.

Reviewed Changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated no comments.

File Description
internal/transformers/utilities.go Adds IsSimpleCopiableExpression helper for reuse in transforms
internal/transformers/moduletransforms/utilities.go Removes local copy of copiable check; calls the shared helper
internal/transformers/estransforms/logicalassignment.go Implements the logical assignment downlevel transform
testdata/baselines/reference/submodule/conformance/logicalAssignment*.js* Updates emitted-downlevel patterns for &&=, `

@weswigham weswigham enabled auto-merge July 8, 2025 23:04
@weswigham weswigham added this pull request to the merge queue Jul 8, 2025
Merged via the queue into microsoft:main with commit 742fcd2 Jul 8, 2025
22 checks passed
@weswigham weswigham deleted the logicalassigns branch July 8, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants