You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/oxc_minifier/docs/ASSUMPTIONS.md
+3-7Lines changed: 3 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,17 +98,13 @@ eval('var x = 1');
98
98
newFunction('return x');
99
99
```
100
100
101
-
### `arguments` is always [the arguments object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments)
101
+
### No access to a variable named `arguments` outside functions
102
102
103
-
`arguments` variables are only accessed inside functions and not assigned with a different value. We intend to change this assumption to optional in the future.
103
+
`arguments` variables are only accessed inside functions. We intend to change this assumption to optional in the future.
104
104
105
105
```javascript
106
106
// The minifier assumes this never happens:
107
-
console.log(arguments); // This is not the arguments object
108
-
functionf(a) {
109
-
arguments=2; // This makes the arguments variable point not to point to the arguments object
// In non-strict mode, a different value may be reassigned to the `arguments` variable
534
+
if !ctx.current_scope_flags().is_strict_mode(){
535
+
return;
536
+
}
537
+
533
538
// FIXME: this function treats `arguments` not inside a function scope as if they are inside it
534
539
// we should check in a different way than `ctx.is_global_reference`
535
540
@@ -1517,12 +1522,16 @@ where
1517
1522
/// Port from <https://github.com/google/closure-compiler/blob/v20240609/test/com/google/javascript/jscomp/PeepholeSubstituteAlternateSyntaxTest.java>
0 commit comments