Debian Codegraph @

js/src/tests/test262/language/global-code/new.target-arrow.js

raw
1 // |reftest| error:SyntaxError
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-scripts-static-semantics-early-errors
6 es6id: 15.1.1
7 description: An ArrowFunction in global code may not contain `new.target`
8 info: |
9 - It is a Syntax Error if StatementList Contains NewTarget unless the source
10 code containing NewTarget is eval code that is being processed by a direct
11 eval that is contained in function code that is not the function code of an
12 ArrowFunction.
13
14 14.2.3 Static Semantics: Contains
15
16 With parameter symbol.
17
18 ArrowFunction : ArrowParameters => ConciseBody
19
20 1. If symbol is not one of NewTarget, SuperProperty, SuperCall, super or
21 this, return false.
22 2. If ArrowParameters Contains symbol is true, return true.
23 3. Return ConciseBody Contains symbol.
24
25 NOTE Normally, Contains does not look inside most function forms. However,
26 Contains is used to detect new.target, this, and super usage within an
27 ArrowFunction.
28 features: [arrow-function, new.target]
29 negative:
30 phase: parse
31 type: SyntaxError
32 ---*/
33
34 $DONOTEVALUATE();
35
36 () => {
37 new.target;
38 };