Permalink
Browse files

Setter function argument must not be a rest parameter

Fix #1693
Closes gh-1696
  • Loading branch information...
ariya committed Dec 24, 2016
1 parent 577f61a commit 8bdae7411055c7c58102cc86ada8603e0de1bf07
View
@@ -2,6 +2,7 @@
export const Messages = {
BadGetterArity: 'Getter must not have any formal parameters',
BadSetterArity: 'Setter must have exactly one formal parameter',
BadSetterRestParameter: 'Setter function argument must not be a rest parameter',
ConstructorIsAsync: 'Class constructor may not be an async method',
ConstructorSpecialMethod: 'Class constructor may not be an accessor',
DeclarationMissingInitializer: 'Missing initializer in %0 declaration',
View
@@ -3059,6 +3059,8 @@ export class Parser {
const formalParameters = this.parseFormalParameters();
if (formalParameters.params.length !== 1) {
this.tolerateError(Messages.BadSetterArity);
} else if (formalParameters.params[0] instanceof Node.RestElement) {
this.tolerateError(Messages.BadSetterRestParameter);
}
const method = this.parsePropertyMethod(formalParameters);
this.context.allowYield = previousAllowYield;
@@ -1 +0,0 @@
({ set f(...a) { "use strict" } })
@@ -0,0 +1 @@
class X { set f(...y) {} }
Oops, something went wrong.

0 comments on commit 8bdae74

Please sign in to comment.