From 48ce5b09d20dca798b1adaffff10801ca68dca46 Mon Sep 17 00:00:00 2001 From: Dan Wolff Date: Sun, 4 Feb 2018 23:06:57 +0100 Subject: [PATCH] describe a few compiler assumptions --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 99e33af7..3ecd4190 100644 --- a/README.md +++ b/README.md @@ -1102,3 +1102,18 @@ To enable fast minify mode with the API use: ```js UglifyJS.minify(code, { compress: false, mangle: true }); ``` + +### Compiler assumptions + +To allow for better optimizations, the compiler makes various assumptions. + +- `.toString()` and `.valueOf()` have not been overridden, and don't have side effects. +- `undefined`, `NaN` and `Infinity` have not been externally redefined. +- `arguments.callee`, `arguments.caller` and `Function.prototype.caller` are not used. +- The code doesn't expect the contents of `Function.prototype.toString()` or + `Error.prototype.stack` to be anything in particular. +- Getting and setting properties on a plain object does not cause other side effects + (using `.watch()` or `Proxy`). +- Object properties are able to be added (not prevented with + `Object.defineProperty()`, `Object.defineProperties()`, `Object.freeze()` or + `Object.preventExtensions()`).