-
-
Notifications
You must be signed in to change notification settings - Fork 723
fix(minifier): handle { __proto__: null } instanceof Object correctly
#15217
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
fix(minifier): handle { __proto__: null } instanceof Object correctly
#15217
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
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 improves the constant evaluation of instanceof Object expressions in the minifier by handling more edge cases, particularly object literals with __proto__ set to null. The change fixes a test case and improves test coverage from 99.04% to 99.15%.
- Enhanced
instanceof Objectevaluation to correctly handle object expressions with__proto__modifications - Added test coverage for RegExp, arrow functions, function expressions, and class expressions
- Updated snapshot to reflect improved test pass rate
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tasks/coverage/snapshots/minifier_node_compat.snap | Updated test coverage statistics showing one additional passing test |
| crates/oxc_minifier/src/peephole/fold_constants.rs | Added test cases for various expression types with instanceof Object |
| crates/oxc_ecmascript/src/constant_evaluation/mod.rs | Enhanced instanceof evaluation logic to handle edge cases like __proto__: null |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CodSpeed Performance ReportMerging #15217 will not alter performanceComparing Summary
|
Merge activity
|
…ly (#15217) `{ __proto__: null } instanceof Object` should be `false` or kept as-is, or it was compressed to `true`.
60b7c1f to
8b14ec9
Compare

{ __proto__: null } instanceof Objectshould befalseor kept as-is, or it was compressed totrue.