Add tests to verify valid object shorthand properties

Fixes #1202
This commit is contained in:
Leo Balter 2017-09-12 16:52:20 -04:00 committed by Rick Waldron
parent 804e008310
commit 968a2e0466
2 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,29 @@
// Copyright (C) 2017 The V8 Project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are only valid with identifier references,
not computed property names.
esid: sec-object-initializer
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
PropertyName:
LiteralPropertyName
ComputedPropertyName
negative:
phase: early
type: SyntaxError
---*/
var x = "y";
var y = 42;
throw "Test262: This statement should not be evaluated.";
({[x]});

View File

@ -0,0 +1,22 @@
// Copyright (C) 2017 The V8 Project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are only valid with identifier references,
not property names. (0)
esid: sec-object-initializer
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
negative:
phase: early
type: SyntaxError
---*/
throw "Test262: This statement should not be evaluated.";
({0});