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