private-name-early-error-set-method-inside-class.js (694B)
1 // |reftest| error:SyntaxError 2 // Copyright (C) 2018 Leo Balter. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-method-definitions-static-semantics-early-errors 7 description: > 8 Throws an early SyntaxError if a method definition has a private name even 9 inside a class body. (getter method) 10 info: | 11 Static Semantics: Early Errors 12 13 PropertyDefinition : MethodDefinition 14 It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. 15 negative: 16 phase: parse 17 type: SyntaxError 18 features: [class-methods-private, class, class-fields-public] 19 ---*/ 20 21 $DONOTEVALUATE(); 22 23 class C { 24 field = { 25 set #m(x) {} 26 } 27 }