Debian Codegraph @

js/src/tests/test262/language/eval-code/direct/switch-dflt-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-evaldeclarationinstantiation
6 description: >
7 AnnexB extension not honored in strict mode: Function declaration
8 in the `default` 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 switch (1) {\
22 default:\
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);