private-identifiers-not-empty.js (916B)
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-createdynamicfunction 5 description: CreateDynamicFunction throws SyntaxError if there is some invalid private identifier on its body 6 info: | 7 CreateDynamicFunction(constructor, newTarget, kind, args) 8 ... 9 29. Let privateIdentifiers be an empty List. 10 30. If AllPrivateIdentifiersValid of body with the argument privateIdentifiers is false, throw a SyntaxError exception. 11 31. If AllPrivateIdentifiersValid of parameters with the argument privateIdentifiers is false, throw a SyntaxError exception. 12 ... 13 features: [class-fields-private] 14 ---*/ 15 16 assert.throws(SyntaxError, function() { 17 let o = {}; 18 new Function("o.#f"); 19 }, 'It should be a SyntaxError if AllPrivateIdentifiersValid returns false to dynamic function body'); 20 21 22 reportCompare(0, 0);