Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/arrow-body-private-direct-eval-err-contains-newtarget.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/eval-err-contains-newtarget.case
3 // - src/class-elements/initializer-eval-newtarget/cls-decl-private-fields-eval-arrow-body.template
4 /*---
5 description: error if `new.target` in StatementList of eval (direct eval)
6 esid: sec-performeval-rules-in-initializer
7 features: [class, new.target, class-fields-private]
8 flags: [generated]
9 info: |
10 Additional Early Error Rules for Eval Inside Initializer
11 These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
12 ScriptBody : StatementList
13
14 ...
15 The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
16
17 Additional Early Error Rules for Eval Outside Functions
18 These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
19 ScriptBody : StatementList
20
21 It is a Syntax Error if StatementList Contains NewTarget.
22
23 ---*/
24
25
26 var executed = false;
27 class C {
28 #x = eval('executed = true; () => new.target;');
29 x() {
30 this.#x();
31 }
32 }
33
34 var c = new C();
35
36 assert.sameValue(executed, true);
37 assert.sameValue(c.x(), undefined);
38
39 reportCompare(0, 0);