HoriSun / closure-compiler

Automatically exported from code.google.com/p/closure-compiler
0 stars 0 forks source link

Simple enum objects cannot be inlined. #1310

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Consider the following sample code snippet:

///////////////////////////
(function(){
/** @enum {number} */
var OP = { k : 99 };

/** @constructor */
function Interpreter () {
    this.v = OP.k;
}

Interpreter.prototype = /** @lends {Interpreter.prototype} */ {};

var obj = new Interpreter();
console.log(obj.v);

})();

////////////////////////

The OP object cannot get inlined with ADVANCED_OPTIMIZATIONS. But it will be if 
the 'Interpreter.prototype' line is removed. 

It looks quite weird to me.

Original issue reported on code.google.com by coolwan...@gmail.com on 21 Apr 2014 at 11:30

GoogleCodeExporter commented 9 years ago
Issue tracking has been migrated to github. Please make any further comments on 
this issue through https://github.com/google/closure-compiler/issues

Original comment by blic...@google.com on 1 May 2014 at 6:31

GoogleCodeExporter commented 9 years ago

Original comment by blic...@google.com on 1 May 2014 at 6:34