google / google/closure-compiler
Advanced compilation breaks due to lack of __proto__ support?
Open
enhancement
ES6
Types
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
``` js
// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name default.js
// @use_closure_library true
// @formatting pretty_print
// ==/ClosureCompiler==
/** @constructor */
function Base() {
}
Base.prototype.x = 1;
/** @constructor @extends {Base} */
function Derived() {
Base.call(this);
}
Derived.prototype = {
__proto__: Base.prototype,
constructor: Derived
};
var d = new Derived;
alert(d.x);
```
This compiles to:
``` js
function a() {
}
a.prototype = {};
alert((new a).x);
```
Which is clearly not right.
Contributor guide
Assessment
This issue has not been assessed yet.