From 90017051f2bb707f1062f3399c7b8d7a58e8c7ba Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 12 Jan 2021 19:48:33 +0000 Subject: [PATCH] document v8 bug (#4549) closes #4547 --- README.md | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 857cb4e9..9cecfcf4 100644 --- a/README.md +++ b/README.md @@ -879,7 +879,7 @@ can pass additional arguments that control the code output: comments, `"some"` to preserve multi-line comments that contain `@cc_on`, `@license`, or `@preserve` (case-insensitive), a regular expression string (e.g. `/^!/`), or a function which returns `boolean`, e.g. - ```js + ```javascript function(node, comment) { return comment.value.indexOf("@type " + node.TYPE) >= 0; } @@ -1150,7 +1150,7 @@ To enable fast minify mode from the CLI use: uglifyjs file.js -m ``` To enable fast minify mode with the API use: -```js +```javascript UglifyJS.minify(code, { compress: false, mangle: true }); ``` @@ -1182,10 +1182,10 @@ To allow for better optimizations, the compiler makes various assumptions: `Object.defineProperty()`, `Object.defineProperties()`, `Object.freeze()`, `Object.preventExtensions()` or `Object.seal()`). - Earlier versions of JavaScript will throw `SyntaxError` with the following: - ```js + ```javascript ({ - p: 42, - get p() {}, + p: 42, + get p() {}, }); // SyntaxError: Object literal may not have data and accessor property with // the same name @@ -1195,7 +1195,7 @@ To allow for better optimizations, the compiler makes various assumptions: versions of Chrome and Node.js may be altered. - When `toplevel` is enabled, UglifyJS effectively assumes input code is wrapped within `function(){ ... }`, thus forbids aliasing of declared global variables: - ```js + ```javascript A = "FAIL"; var B = "FAIL"; // can be `global`, `self`, `window` etc. @@ -1215,7 +1215,7 @@ To allow for better optimizations, the compiler makes various assumptions: suppress those errors. - Earlier versions of Chrome and Node.js will throw `ReferenceError` with the following: - ```js + ```javascript var a; try { throw 42; @@ -1228,20 +1228,29 @@ To allow for better optimizations, the compiler makes various assumptions: ``` UglifyJS may modify the input which in turn may suppress those errors. - Later versions of JavaScript will throw `SyntaxError` with the following: - ```js + ```javascript a => { - let a; + let a; }; // SyntaxError: Identifier 'a' has already been declared ``` UglifyJS may modify the input which in turn may suppress those errors. - Later versions of JavaScript will throw `SyntaxError` with the following: - ```js + ```javascript try { - // ... + // ... } catch ({ message: a }) { - var a; + var a; } // SyntaxError: Identifier 'a' has already been declared ``` UglifyJS may modify the input which in turn may suppress those errors. +- Some versions of Chrome and Node.js will throw `ReferenceError` with the + following: + ```javascript + console.log(((a, b = function() { + return a; + // ReferenceError: a is not defined + }()) => b)()); + ``` + UglifyJS may modify the input which in turn may suppress those errors.