if-stmt-else-fun-strict-strict.js (1103B)
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 second 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 B.3.3.2 Changes to GlobalDeclarationInstantiation 23 24 1. 1. Let strict be IsStrict of script 25 2. If strict is *false*, then 26 [...] 27 ---*/ 28 29 $DONOTEVALUATE(); 30 31 if (false) ; else function f() {}