Debian Codegraph @

js/src/tests/test262/language/function-code/switch-case-decl-onlystrict-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 esid: sec-web-compat-functiondeclarationinstantiation
6 description: >
7 AnnexB extension not honored in strict mode, Function declaration
8 in the `case` clause of a `switch` statement in function code
9 info: |
10 B.3.3.1 Changes to FunctionDeclarationInstantiation
11
12 1. If strict is false, then
13 ...
14
15 flags: [onlyStrict]
16 ---*/
17
18 var err1, err2;
19
20 (function() {
21 try {
22 f;
23 } catch (exception) {
24 err1 = exception;
25 }
26
27 switch (1) {
28 case 1:
29 function f() { }
30 }
31
32 try {
33 f;
34 } catch (exception) {
35 err2 = exception;
36 }
37 }());
38
39 assert.sameValue(err1.constructor, ReferenceError);
40 assert.sameValue(err2.constructor, ReferenceError);
41
42 reportCompare(0, 0);