target-newtarget.js (768B)
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-assignment-operators-static-semantics-early-errors 6 description: Applied to new.target 7 info: | 8 AssignmentExpression : LeftHandSideExpression = AssignmentExpression 9 10 - It is an early Syntax Error if LeftHandSideExpression is neither an 11 ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of 12 LeftHandSideExpression is invalid or strict. 13 14 12.3.1.6 Static Semantics: AssignmentTargetType 15 16 NewTarget: 17 18 new.target 19 20 1. Return invalid. 21 negative: 22 phase: parse 23 type: SyntaxError 24 features: [new.target] 25 ---*/ 26 27 $DONOTEVALUATE(); 28 29 function f() { 30 new.target = 1; 31 }