fix(minifier): keep property access before call expressions as-is to preserve this value#13278
Merged
graphite-app[bot] merged 1 commit intomainfrom Aug 24, 2025
Conversation
This was referenced Aug 24, 2025
Member
Author
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a minification bug where property access expressions followed by function calls were being over-optimized, causing incorrect this binding. The fix prevents the transformation of expressions like ['PASS',f][1]() to f() when the property access is immediately followed by a call expression.
- Adds a guard condition to preserve property access when it's the callee of a function call or tagged template
- Includes a test case demonstrating the bug scenario with
thisvalue preservation
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
32fc2e6 to
8d324c1
Compare
CodSpeed Instrumentation Performance ReportMerging #13278 will not alter performanceComparing Summary
Footnotes |
This was referenced Aug 24, 2025
Contributor
Merge activity
|
…preserve `this` value (#13278) `['PASS',f][1]()` was compressed to `f()`. But this is not safe because `f` may access `this` and the value of `this` changes. This PR fixes that by skipping this transformation when the parent is a function call.
8d324c1 to
6003285
Compare
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.

['PASS',f][1]()was compressed tof(). But this is not safe becausefmay accessthisand the value ofthischanges.This PR fixes that by skipping this transformation when the parent is a function call.