labelled-fn-stmt-second.js (876B)
1 // |reftest| error:SyntaxError 2 // Copyright (C) 2016 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-if-statement-static-semantics-early-errors 6 es6id: 13.6.1 7 description: > 8 A labelled function declaration is never permitted in the second of two 9 Statement positions 10 info: | 11 IfStatement : 12 13 if ( Expression ) Statement else Statement 14 if ( Expression ) Statement 15 16 - It is a Syntax Error if IsLabelledFunction(Statement) is true. 17 18 NOTE It is only necessary to apply this rule if the extension specified in 19 B.3.2 is implemented. 20 21 In the absence of Annex B.3.2, a SyntaxError should be produced due to the 22 labelled function declaration itself. 23 negative: 24 phase: parse 25 type: SyntaxError 26 ---*/ 27 28 $DONOTEVALUATE(); 29 30 if (true) ; else label1: label2: function test262() {}