static-init-without-label.js (783B)
1 // |reftest| error:SyntaxError 2 // Copyright (C) 2021 the V8 project authors. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 /*--- 5 esid: sec-break-statement 6 description: IterationStatement search does not traverse static initialization block boundaries (no label specified) 7 info: | 8 4.2.1 Static Semantics: Early Errors 9 BreakStatement : break ; 10 11 - It is a Syntax Error if this BreakStatement is not nested, directly or 12 indirectly (but not crossing function or static initialization block 13 boundaries), within an IterationStatement or a SwitchStatement. 14 negative: 15 phase: parse 16 type: SyntaxError 17 features: [class-static-block] 18 ---*/ 19 20 $DONOTEVALUATE(); 21 22 label: while(false) { 23 class C { 24 static { 25 break; 26 } 27 } 28 }