Debian Codegraph @

js/src/tests/test262/language/global-code/switch-dflt-decl-strict-strict.js

raw
1 'use strict';
2 // Copyright (C) 2016 the V8 project authors. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 description: AnnexB extension not honored in strict mode (Funtion declaration in the `default` clause of a `switch` statement in the global scope)
6 es6id: B.3.3.2
7 flags: [onlyStrict]
8 info: |
9 B.3.3.2 Changes to GlobalDeclarationInstantiation
10
11 1. 1. Let strict be IsStrict of script
12 2. If strict is *false*, then
13 [...]
14 ---*/
15
16 assert.throws(ReferenceError, function() {
17 f;
18 });
19
20 switch (1) {
21 default:
22 function f() { }
23 }
24
25 assert.throws(ReferenceError, function() {
26 f;
27 });
28
29 reportCompare(0, 0);