summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js
blob: 3c72d3aeb19dd2453d9797c98463693278766d7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// |reftest| error:SyntaxError
// Copyright (C) 2018 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-block-static-semantics-early-errors
description: >
  Redeclaration with VariableDeclaration (FunctionDeclaration in BlockStatement)
info: |
  13.2.1 Static Semantics: Early Errors

  It is a Syntax Error if any element of the LexicallyDeclaredNames of
  StatementList also occurs in the VarDeclaredNames of StatementList.
negative:
  phase: parse
  type: SyntaxError
---*/

$DONOTEVALUATE();

function g() {
    // Create an outer block-statement.
    {
        // A lexically declared function declaration.
        function f() {}

        // An inner block-statement with a variable-declared name.
        {
            var f;
        }
    }
}