identifier-shorthand-invalid-computed-name.js (634B)
1 // |reftest| error:SyntaxError 2 // Copyright (C) 2017 The V8 Project authors. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 description: > 7 Object literal shorthands are only valid with identifier references, 8 not computed property names. 9 esid: sec-object-initializer 10 info: | 11 PropertyDefinition: 12 IdentifierReference 13 CoverInitializedName 14 PropertyName : AssignmentExpression 15 MethodDefinition 16 17 PropertyName: 18 LiteralPropertyName 19 ComputedPropertyName 20 negative: 21 phase: parse 22 type: SyntaxError 23 ---*/ 24 25 var x = "y"; 26 var y = 42; 27 28 $DONOTEVALUATE(); 29 30 ({[x]});