Debian Codegraph @

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