Debian Codegraph @

js/src/tests/test262/language/eval-code/direct/switch-case-decl-eval-source-is-strict-nostrict.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-web-compat-evaldeclarationinstantiation
5 description: >
6 AnnexB extension not honored in strict mode, Function declaration
7 in the `case` clause of a `switch` statement in eval code
8 info: |
9 B.3.3.3 Changes to EvalDeclarationInstantiation
10
11 1. If strict is false, then
12 ...
13
14 flags: [noStrict]
15 ---*/
16
17 var err;
18
19 eval('\
20 "use strict";\
21 switch (1) {\
22 case 1:\
23 function f() { }\
24 }\
25 ');
26
27 try {
28 f;
29 } catch (exception) {
30 err = exception;
31 }
32
33 assert.sameValue(err.constructor, ReferenceError);
34
35 reportCompare(0, 0);