if-fun-else-stmt-strict-strict.js (1041B)
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 esid: sec-if-statement 8 es6id: 13.6 9 flags: [onlyStrict] 10 negative: 11 phase: parse 12 type: SyntaxError 13 info: | 14 The following rules for IfStatement augment those in 13.6: 15 16 IfStatement[Yield, Return]: 17 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] 18 if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] 19 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] 20 if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] 21 22 The above rules are only applied when parsing code that is not strict mode code. 23 ---*/ 24 25 $DONOTEVALUATE(); 26 27 if (true) function f() {} else ;