-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Compiler Assumptions
Chad Killingsworth edited this page Jul 7, 2014
·
11 revisions
To allow for better optimizations in the general case, the compiler makes various assumptions. This is an attempt to document these assumptions more fully.
The most important assumptions are described in Understanding the Restrictions Imposed by the Closure Compiler, however there are some additional assumptions.
- Name references are assumed to never throw, as described here
- Property reads are assumed to be side effect free, as described here. We support getters only if they are side-effect free
- In ADVANCED mode, property sets do not have arbitrary side-effects (it is ok to remove property writes if the property is never read), as described here
- The original value of Function.length may not be preserved, as described here.
- To String And Value Of are assumed to be side-effect free.
Math object methods are side-effect free.- instanceof is assumed to never throw
General:
- "undefined", "NaN" and "Infinity" have not been externally redefined.
- Object, Array, String, Number and Boolean have not be redefined. Standard methods on Object, Array, String, Number and Boolean have not be redefined in a way that breaks the original contract.