Guard private syntax preservation by transform profile - #58253
Open
OskarEichler wants to merge 1 commit into
Open
Guard private syntax preservation by transform profile#58253OskarEichler wants to merge 1 commit into
OskarEichler wants to merge 1 commit into
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary:
customTransformOptions.unstable_preserveClassPrivatecurrently disables private-field and private-method transforms for every profile. Withhermes-legacy, the preset still lowers the surrounding class syntax, and Babel then aborts because its class transform requires the private transforms.Only preserve private syntax when the selected profile also preserves class syntax. Stable and canary Hermes profiles keep their existing experimental behavior; legacy profiles continue lowering private fields and methods together with classes instead of crashing.
Changelog:
[GENERAL] [FIXED] - Keep private class transforms enabled for profiles that lower classes.
Test Plan:
hermes-legacyregression containing both a private field and private method with the preservation option enabled.git diff --checkpass.No breaking change: stable/canary preservation is unchanged, while an invalid legacy configuration now compiles correctly.