Debian Codegraph @

js/src/tests/test262/built-ins/eval/private-identifiers-not-empty.js

raw
1 // Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-evaldeclarationinstantiation
5 description: EvalDeclarationInstantiation throws SyntaxError if there is some invalid private identifier on its body
6 info: |
7 EvalDeclarationInstantiation(body, varEnv, lexEnv, privateEnv, strict)
8 ...
9 6. Let privateIdentifiers be an empty List.
10 7. Let privateEnv be privateEnv.
11 8. Repeat while privateEnv is not null,
12 a. For each binding named N in privateEnv,
13 i. If privateIdentifiers does not contain N, append N to privateIdentifiers.
14 b. Let privateEnv be privateEnv's outer environment reference.
15 9. If AllPrivateIdentifiersValid of body with the argument privateIdentifiers is false, throw a SyntaxError exception.
16 ...
17 features: [class-fields-private]
18 ---*/
19
20 assert.throws(SyntaxError, function() {
21 let o = {};
22 eval("o.#f");
23 }, 'It should be a SyntaxError if AllPrivateIdentifiersValid returns false to eval body');
24
25
26 reportCompare(0, 0);