14
README.md
14
README.md
@@ -1209,6 +1209,20 @@ To allow for better optimizations, the compiler makes various assumptions:
|
||||
`function({}, arguments) {}` will result in `SyntaxError` in earlier versions
|
||||
of Chrome and Node.js - UglifyJS may modify the input which in turn may
|
||||
suppress those errors.
|
||||
- Earlier versions of Chrome and Node.js will throw `ReferenceError` with the
|
||||
following:
|
||||
```js
|
||||
var a;
|
||||
try {
|
||||
throw 42;
|
||||
} catch ({
|
||||
[a]: b,
|
||||
// ReferenceError: a is not defined
|
||||
}) {
|
||||
let a;
|
||||
}
|
||||
```
|
||||
UglifyJS may modify the input which in turn may suppress those errors.
|
||||
- Later versions of JavaScript will throw `SyntaxError` with the following:
|
||||
```js
|
||||
a => {
|
||||
|
||||
@@ -208,6 +208,14 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
|
||||
self.globals = new Dictionary();
|
||||
var in_arg = [];
|
||||
var tw = new TreeWalker(function(node) {
|
||||
if (node instanceof AST_Catch) {
|
||||
if (!(node.argname instanceof AST_Destructured)) return;
|
||||
in_arg.push(node);
|
||||
node.argname.walk(tw);
|
||||
in_arg.pop();
|
||||
walk_body(node, tw);
|
||||
return true;
|
||||
}
|
||||
if (node instanceof AST_Lambda) {
|
||||
in_arg.push(node);
|
||||
node.argnames.forEach(function(argname) {
|
||||
|
||||
@@ -1968,3 +1968,36 @@ issue_4399: {
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_4420: {
|
||||
options = {
|
||||
unused: true,
|
||||
}
|
||||
input: {
|
||||
console.log(function() {
|
||||
var a = 1;
|
||||
try {
|
||||
throw [ "FAIL", "PASS" ];
|
||||
} catch ({
|
||||
[a]: b,
|
||||
}) {
|
||||
let a = 0;
|
||||
return b;
|
||||
}
|
||||
}());
|
||||
}
|
||||
expect: {
|
||||
console.log(function() {
|
||||
var a = 1;
|
||||
try {
|
||||
throw [ "FAIL", "PASS" ];
|
||||
} catch ({
|
||||
[a]: b,
|
||||
}) {
|
||||
return b;
|
||||
}
|
||||
}());
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
node_version: ">=8"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user