new.target.js (765B)
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: A direct eval in global code may not contain `new.target` 7 info: | 8 - It is a Syntax Error if StatementList Contains NewTarget unless the source 9 code containing NewTarget is eval code that is being processed by a direct 10 eval that is contained in function code that is not the function code of an 11 ArrowFunction. 12 features: [new.target] 13 ---*/ 14 15 var caught; 16 17 try { 18 eval('new.target;'); 19 } catch (err) { 20 caught = err; 21 } 22 23 assert.sameValue(typeof caught, 'object'); 24 assert.sameValue(caught.constructor, SyntaxError); 25 26 reportCompare(0, 0);