-
Notifications
You must be signed in to change notification settings - Fork 1.2k
describe a few compiler assumptions #2883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
48ce5b0
b3128f0
46f893b
90508c6
600ed69
a0d408e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1102,3 +1102,26 @@ To enable fast minify mode with the API use: | |
| ```js | ||
| UglifyJS.minify(code, { compress: false, mangle: true }); | ||
| ``` | ||
|
|
||
| #### Source maps and debugging | ||
|
|
||
| Various `compress` transforms that simplify, rearrange, inline and remove code | ||
| are known to have an adverse effect on debugging with source maps. This is | ||
| expected as code is optimized and mappings are often simply not possible as | ||
| some code no longer exists. For highest fidelity in source map debugging | ||
| disable the Uglify `compress` option and just use `mangle`. | ||
|
|
||
| ### 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. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a suggestion for how to phrase this? My take:
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... only if
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a0d408e is good. |
||
| - `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 can be added, removed and modified (not prevented with | ||
| `Object.defineProperty()`, `Object.defineProperties()`, `Object.freeze()`, | ||
| `Object.preventExtensions()` or `Object.seal()`). | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace the period at the end of the line with a colon.