Debian Codegraph @

js/src/tests/test262/language/eval-code/direct/switch-case-decl-eval-source-is-strict-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-evaldeclarationinstantiation
6 description: >
7 AnnexB extension not honored in strict mode, Function declaration
8 in the `case` clause of a `switch` statement in eval code
9 info: |
10 B.3.3.3 Changes to EvalDeclarationInstantiation
11
12 1. If strict is false, then
13 ...
14
15 flags: [onlyStrict]
16 ---*/
17
18 var err;
19
20 eval('\
21 "use strict";\
22 switch (1) {\
23 case 1:\
24 function f() { }\
25 }\
26 ');
27
28 try {
29 f;
30 } catch (exception) {
31 err = exception;
32 }
33
34 assert.sameValue(err.constructor, ReferenceError);
35
36 reportCompare(0, 0);