google/closure-compiler — pull request #474 by vhristov (2014-06-09 21:36:42+00:00)
Title: Add support for Object.defineProperty

There are many libraries which have extensive use of
Object.defineProperty. The problem with all of them is they cannot be
compiled in advanced mode without a heavy modifications, due to the
property rename issues.

So far there is already a support for setter and getters using the
"set foo() {}" and "get foo() {}", but having setters/getters defined
using Object.defineProperty was not yet supported.

Due to the fact that the property name is declared using a pure string
there is no way for the compiler to rename the string (without breaking
the assumption that string should not be renamed) so it is assumed that
every property access to the defined property should be treated as
exposed. While this have the negative impact of a bit increased output
size, this can be neglected by the fact that:
1. There are currently no uses of ADVANCED_COMPILATION with
setter/getters from Object.defineProperty which are not already
using the array access notation (because it was simply not working
until now).
2. Benefit that more of the already available libraries can be used
for compilation without any modifications.

Still there is no way for the compiler to handle non literal strings for
the property name. This limitation is even harder (impossible?) to
outcome when the property name is generated dynamically at run time.