refactor(minifier,ecmascript): clean up is_global_reference#12953
refactor(minifier,ecmascript): clean up is_global_reference#12953
is_global_reference#12953Conversation
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. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the is_global_reference method in the GlobalContext trait by changing its return type from Option<bool> to bool, simplifying the API and eliminating the need to handle None cases throughout the codebase.
- Changed
GlobalContext::is_global_referencereturn type fromOption<bool>tobool - Updated all implementations and call sites to use the simplified boolean return type
- Added a new
is_global_exprhelper method to theGlobalContexttrait - Consolidated duplicate
GlobalReferenceInformationstructs into a shared module definition
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_ecmascript/src/global_context.rs | Updated trait definition and added is_global_expr helper method |
| crates/oxc_minifier/src/ctx.rs | Updated implementation to return bool directly |
| crates/oxc_minifier/tests/ecmascript/value_type.rs | Updated test implementation to return bool |
| crates/oxc_minifier/tests/ecmascript/may_have_side_effects.rs | Updated test implementation to return bool |
| crates/oxc_minifier/tests/ecmascript/mod.rs | Added shared GlobalReferenceInformation struct |
| crates/oxc_minifier/tests/ecmascript/to_string.rs | Removed duplicate struct, uses shared implementation |
| crates/oxc_minifier/tests/ecmascript/to_number.rs | Removed duplicate struct, uses shared implementation |
| crates/oxc_minifier/tests/ecmascript/to_boolean.rs | Removed duplicate struct, uses shared implementation |
| crates/oxc_ecmascript/src/to_string.rs | Simplified boolean check logic |
| crates/oxc_ecmascript/src/to_number.rs | Simplified boolean check logic |
| crates/oxc_ecmascript/src/to_boolean.rs | Simplified boolean check logic |
| crates/oxc_ecmascript/src/side_effects/may_have_side_effects.rs | Updated to use new boolean return type |
| crates/oxc_ecmascript/src/constant_evaluation/value_type.rs | Updated to use new boolean return and is_global_expr helper |
| crates/oxc_ecmascript/src/constant_evaluation/mod.rs | Simplified boolean check logic |
| crates/oxc_ecmascript/src/constant_evaluation/call_expr.rs | Replaced custom validation with is_global_expr helper |
CodSpeed Instrumentation Performance ReportMerging #12953 will not alter performanceComparing Summary
|
No description provided.