This code
function Test() {}
Test.prototype = {
get test() {
},
set test(val) {
}
};
Produces this errors on https://closure-compiler.appspot.com/
Number of errors: 2
JSC_CANNOT_CONVERT: This code cannot be converted from ES6. ES5 getters/setters (consider using --language_out=ES5) at line 4 character 6
get test() {
^
JSC_CANNOT_CONVERT: This code cannot be converted from ES6. ES5 getters/setters (consider using --language_out=ES5) at line 8 character 6
set test(val) {
^
This is part of ES5 and following specs (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) and is implemented by engines for a while.
So why it produces errors?
Like the compiler itself, the web service defaults language_out to ES3, try adding:
// @language_out ecmascript5
To the beginning of the file.
I think it's
// @language_out ES5
It is ->
// @language ECMASCRIPT5
Most helpful comment
It is ->
// @language ECMASCRIPT5