-
Notifications
You must be signed in to change notification settings - Fork 591
Add esnext
transform
#819
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
Add esnext
transform
#819
Conversation
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.
Pull Request Overview
This PR adds support for the ESNext transform to downlevel ‘using’ and ‘await using’ declarations by modifying the transformation and printer layers, among other updates. Key changes include renaming module IIFE parameters in baseline tests, updating various helper and AST transformation functions from binary expressions to assignment expressions, and revising name generation and helper functions in the printer.
Reviewed Changes
Copilot reviewed 460 out of 461 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
testdata/baselines/reference/submodule/compiler/collisionCodeGenModuleWithConstructorChildren.js | Renames IIFE parameter from M_1 to M_2 to avoid conflicts |
testdata/baselines/reference/submodule/compiler/collisionCodeGenModuleWithAccessorChildren.js | Consistent renaming of IIFE parameters to M_2 and M_3 |
internal/transformers/*.go | Updates transformation logic (e.g. replacing NewBinaryExpression with NewAssignmentExpression) to support ESNext syntax |
internal/printer/* | Adjustments in name generation and helper invocations including updates in test expectations |
internal/ast/utilities.go | Added a new helper (RangeIsSynthesized) for synthetic position checking |
Files not reviewed (1)
- testdata/baselines/reference/submodule/compiler/collisionCodeGenModuleWithAccessorChildren.js.diff: Language not supported
Comments suppressed due to low confidence (2)
internal/printer/namegenerator_test.go:208
- [nitpick] The test currently expects "foo_2" for a unique name in a scoped context, although the comment indicates that "foo_1" may be more appropriate. Please verify and update the expected behavior in line with the intended scoping rules once the port is complete.
assert.Equal(t, "foo_2", g.GenerateName(name2)) // Matches Strada, but is incorrect
internal/printer/namegenerator.go:106
- [nitpick] This comment indicates that the generated names are currently being added to a global set rather than being scoped per the current nameGenerationScope. Consider revising this logic so that generated names are tracked per scope if that behavior is the intended design.
g.generatedNames.Add(name) // NOTE: Matches Strada, but is incorrect.
This adds the ESNext transform, which handles the downlevel transformation of
using
andawait using
declarations.This PR is dependent on #815, so most feedback related to ast/ast.go, printer/emitcontext.go, and printer/factory.go should be addressed there.