function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js (825B)
1 // |reftest| error:SyntaxError 2 // Copyright (C) 2018 André Bargull. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-block-static-semantics-early-errors 7 description: > 8 Redeclaration with VariableDeclaration (FunctionDeclaration in BlockStatement) 9 info: | 10 13.2.1 Static Semantics: Early Errors 11 12 It is a Syntax Error if any element of the LexicallyDeclaredNames of 13 StatementList also occurs in the VarDeclaredNames of StatementList. 14 negative: 15 phase: parse 16 type: SyntaxError 17 ---*/ 18 19 $DONOTEVALUATE(); 20 21 function g() { 22 // Create an outer block-statement. 23 { 24 // A lexically declared function declaration. 25 function f() {} 26 27 // An inner block-statement with a variable-declared name. 28 { 29 var f; 30 } 31 } 32 }