const getters/setters are unsupported (simply omit the setter)
parent
4ada84e3b7
commit
9942ac9743
|
@ -291,6 +291,14 @@ exports.prototype.validateGetterSetter = function(
|
|||
);
|
||||
}
|
||||
|
||||
// for const getters/setters, omit the setter
|
||||
if ( keywords[ 'const' ] )
|
||||
{
|
||||
throw TypeError(
|
||||
"Cannot declare const getter/setter '" + name + "'"
|
||||
);
|
||||
}
|
||||
|
||||
if ( prev || prev_gs )
|
||||
{
|
||||
// perform this check first, as it will make more sense than those that
|
||||
|
|
|
@ -154,4 +154,15 @@ require( 'common' ).testCase(
|
|||
{
|
||||
this.quickKeywordTest( [ 'abstract' ], 'abstract' );
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* As getters/setters are essentially methods, they are treated very
|
||||
* similarity. They cannot be declared as const. Rather, that should be
|
||||
* handled by omitting a setter.
|
||||
*/
|
||||
'Cannot declare const getters/setters': function()
|
||||
{
|
||||
this.quickKeywordTest( [ 'const' ], 'const' );
|
||||
},
|
||||
} );
|
||||
|
|
Loading…
Reference in New Issue