Debian Codegraph @

js/src/tests/test262/language/eval-code/direct/new.target-arrow.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-scripts-static-semantics-early-errors
5 es6id: 15.1.1
6 description: >
7 A direct eval in the functon code of an ArrowFunction may not contain
8 `new.target`
9 info: |
10 - It is a Syntax Error if StatementList Contains NewTarget unless the source
11 code containing NewTarget is eval code that is being processed by a direct
12 eval that is contained in function code that is not the function code of an
13 ArrowFunction.
14 features: [arrow-function, new.target]
15 ---*/
16
17 var caught;
18 var f = () => eval('new.target;');
19
20 try {
21 f();
22 } catch (err) {
23 caught = err;
24 }
25
26 assert.sameValue(typeof caught, 'object');
27 assert.sameValue(caught.constructor, SyntaxError);
28
29 reportCompare(0, 0);