diff --git a/test/language/expressions/object/identifier-shorthand-invalid-computed-name.js b/test/language/expressions/object/identifier-shorthand-invalid-computed-name.js new file mode 100644 index 0000000000..ce8b745c88 --- /dev/null +++ b/test/language/expressions/object/identifier-shorthand-invalid-computed-name.js @@ -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]}); diff --git a/test/language/expressions/object/identifier-shorthand-invalid-zero.js b/test/language/expressions/object/identifier-shorthand-invalid-zero.js new file mode 100644 index 0000000000..636cde86f4 --- /dev/null +++ b/test/language/expressions/object/identifier-shorthand-invalid-zero.js @@ -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});