Add coverage for reserved words in shorthand properties. Fixes gh-1179

This commit is contained in:
Rick Waldron 2020-09-15 17:50:20 -04:00
parent ab4a019a4d
commit 057a31e15e
9 changed files with 297 additions and 0 deletions

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (implements)
esid: sec-object-initializer
flags: [noStrict]
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and
the StringValue of IdentifierName is: "implements", "interface", "let",
"package", "private", "protected", "public", "static", or "yield".
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
var implements = 1;
(function() {
"use strict";
({
implements
});
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (interface)
esid: sec-object-initializer
flags: [noStrict]
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and
the StringValue of IdentifierName is: "implements", "interface", "let",
"package", "private", "protected", "public", "static", or "yield".
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
var interface = 1;
(function() {
"use strict";
({
interface
});
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (let)
esid: sec-object-initializer
flags: [noStrict]
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and
the StringValue of IdentifierName is: "implements", "interface", "let",
"package", "private", "protected", "public", "static", or "yield".
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
var let = 1;
(function() {
"use strict";
({
let
});
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (package)
esid: sec-object-initializer
flags: [noStrict]
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and
the StringValue of IdentifierName is: "implements", "interface", "let",
"package", "private", "protected", "public", "static", or "yield".
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
var package = 1;
(function() {
"use strict";
({
package
});
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (private)
esid: sec-object-initializer
flags: [noStrict]
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and
the StringValue of IdentifierName is: "implements", "interface", "let",
"package", "private", "protected", "public", "static", or "yield".
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
var private = 1;
(function() {
"use strict";
({
private
});
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (protected)
esid: sec-object-initializer
flags: [noStrict]
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and
the StringValue of IdentifierName is: "implements", "interface", "let",
"package", "private", "protected", "public", "static", or "yield".
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
var protected = 1;
(function() {
"use strict";
({
protected
});
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (public)
esid: sec-object-initializer
flags: [noStrict]
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and
the StringValue of IdentifierName is: "implements", "interface", "let",
"package", "private", "protected", "public", "static", or "yield".
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
var public = 1;
(function() {
"use strict";
({
public
});
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (static)
esid: sec-object-initializer
flags: [noStrict]
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and
the StringValue of IdentifierName is: "implements", "interface", "let",
"package", "private", "protected", "public", "static", or "yield".
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
var static = 1;
(function() {
"use strict";
({
static
});
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (yield)
esid: sec-object-initializer
flags: [noStrict]
info: |
PropertyDefinition:
IdentifierReference
CoverInitializedName
PropertyName : AssignmentExpression
MethodDefinition
Identifier : IdentifierName but not ReservedWord
It is a Syntax Error if this phrase is contained in strict mode code and
the StringValue of IdentifierName is: "implements", "interface", "let",
"package", "private", "protected", "public", "static", or "yield".
negative:
phase: parse
type: SyntaxError
---*/
$DONOTEVALUATE();
var yield = 1;
(function() {
"use strict";
({
yield
});
});