summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/Syntax/declaration-forbidden-in-label.js
blob: 53acb399615b26fada0bf9fa08df788099e9b816 (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
33
34
/*
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/licenses/publicdomain/
 */

//-----------------------------------------------------------------------------
var BUGNUMBER = 1288459;
var summary =
  "Properly implement the spec's distinctions between StatementListItem and " +
  "Statement grammar productions and their uses";

print(BUGNUMBER + ": " + summary);

/**************
 * BEGIN TEST *
 **************/

assertThrowsInstanceOf(() => Function("a: let x;"), SyntaxError);
assertThrowsInstanceOf(() => Function("b: const y = 3;"), SyntaxError);
assertThrowsInstanceOf(() => Function("c: class z {};"), SyntaxError);

assertThrowsInstanceOf(() => Function("'use strict'; d: function w() {};"), SyntaxError);

// Annex B.3.2 allows this in non-strict mode code.
Function("e: function x() {};");

assertThrowsInstanceOf(() => Function("f: function* y() {}"), SyntaxError);

/******************************************************************************/

if (typeof reportCompare === "function")
  reportCompare(true, true);

print("Tests complete");