if-decl-else-stmt-strict-strict.js (1021B)
1 // |reftest| error:SyntaxError 2 'use strict'; 3 // Copyright (C) 2016 the V8 project authors. All rights reserved. 4 // This code is governed by the BSD license found in the LICENSE file. 5 /*--- 6 description: AnnexB extension not honored in strict mode (IfStatement with a declaration in the first statement position in the global scope) 7 es6id: B.3.4 8 flags: [onlyStrict] 9 negative: 10 phase: parse 11 type: SyntaxError 12 info: | 13 The following rules for IfStatement augment those in 13.6: 14 15 IfStatement[Yield, Return]: 16 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] 17 if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] 18 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] 19 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] 20 21 The above rules are only applied when parsing code that is not strict mode code. 22 ---*/ 23 24 $DONOTEVALUATE(); 25 26 if (true) function f() { } else ;