Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/identifier-shorthand-invalid-computed-name.js

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