document ECMAScript quirks (#5501)

closes #5500
This commit is contained in:
Alex Lam S.L
2022-06-08 20:01:00 +01:00
committed by GitHub
parent 123f9cf987
commit f749863cb2
2 changed files with 13 additions and 1 deletions

View File

@@ -1429,3 +1429,13 @@ To allow for better optimizations, the compiler makes various assumptions:
// Actual: "undefined 42"
```
UglifyJS may modify the input which in turn may suppress those errors.
- Later versions of JavaScript will throw `SyntaxError` with the following:
```javascript
"use strict";
console.log(function f() {
return f = "PASS";
}());
// Expected: "PASS"
// Actual: TypeError: invalid assignment to const 'f'
```
UglifyJS may modify the input which in turn may suppress those errors.

View File

@@ -2127,7 +2127,9 @@ function errorln(msg) {
}
function try_beautify(code, toplevel, result, printfn, options) {
var beautified = UglifyJS.minify(code, JSON.parse(beautify_options));
var o = JSON.parse(beautify_options);
if (async && has_await) o.module = true;
var beautified = UglifyJS.minify(code, o);
if (beautified.error) {
printfn("// !!! beautify failed !!!");
printfn(beautified.error);