refactor(ecmascript): consolidate side-effect known globals into separate module#20401
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. |
Merging this PR will not alter performance
Comparing Footnotes
|
3c4a9ec to
f205721
Compare
305e281 to
ada6427
Compare
3c200c3 to
9e63e4a
Compare
Merge activity
|
5ebee41 to
b03fc1d
Compare
9e63e4a to
ded6e3a
Compare
b03fc1d to
7c0f44d
Compare
ded6e3a to
0fb31df
Compare
7c0f44d to
efeba28
Compare
0fb31df to
e67ca72
Compare
e67ca72 to
0922623
Compare
…rate module (#20401) ## Summary - Extract all global lookup tables (~430 lines) into a new `known_globals.rs` module, keeping `expressions.rs` focused on `MayHaveSideEffects` trait implementations - Extract `is_pure_math_method` to deduplicate 36 Math method names shared between read-safety (`is_known_global_property`) and call-safety (`is_pure_global_method_call`) checks - Extract inline call-safe match into a named `is_pure_global_method_call` function with clear doc comments - Rename `is_pure_call` → `is_pure_callable_constructor`, removing 4 dead entries (`String`, `Number`, `BigInt`, `Symbol`) already handled by earlier special-case logic - Redefine `is_unconditionally_pure_constructor` in terms of `is_pure_callable_constructor` to keep error-type lists in sync - **Fix**: use `is_typed_array_constructor` for the TypedArray `.of()` arm, adding previously missing `BigInt64Array` and `BigUint64Array` ## Test plan - [x] Added tests for `BigInt64Array.of()` and `BigUint64Array.of()` - [x] All existing `side_effects` tests pass - [x] `cargo clippy` clean 🤖 Generated with [Claude Code](https://claude.com/claude-code)
0922623 to
878eace
Compare

Summary
known_globals.rsmodule, keepingexpressions.rsfocused onMayHaveSideEffectstrait implementationsis_pure_math_methodto deduplicate 36 Math method names shared between read-safety (is_known_global_property) and call-safety (is_pure_global_method_call) checksis_pure_global_method_callfunction with clear doc commentsis_pure_call→is_pure_callable_constructor, removing 4 dead entries (String,Number,BigInt,Symbol) already handled by earlier special-case logicis_unconditionally_pure_constructorin terms ofis_pure_callable_constructorto keep error-type lists in syncis_typed_array_constructorfor the TypedArray.of()arm, adding previously missingBigInt64ArrayandBigUint64ArrayTest plan
BigInt64Array.of()andBigUint64Array.of()side_effectstests passcargo clippyclean🤖 Generated with Claude Code