diff options
Diffstat (limited to 'src')
11 files changed, 232 insertions, 0 deletions
diff --git a/src/class-fields/propname-constructor.case b/src/class-fields/propname-constructor.case new file mode 100644 index 000000000..3353606dd --- /dev/null +++ b/src/class-fields/propname-constructor.case @@ -0,0 +1,18 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: class fields forbid PropName 'constructor' +info: | + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : FieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "constructor". +features: [class-fields] +template: propname-error +---*/ + +//- propname +constructor diff --git a/src/class-fields/propname-error/cls-decl-computed-name.template b/src/class-fields/propname-error/cls-decl-computed-name.template new file mode 100644 index 000000000..406a20970 --- /dev/null +++ b/src/class-fields/propname-error/cls-decl-computed-name.template @@ -0,0 +1,22 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions-static-semantics-early-errors +path: language/statements/class/fields-computed-name- +name: no early error -- PropName of ComputedPropertyName not forbidden value +info: | + Static Semantics: PropName + ... + ComputedPropertyName : [ AssignmentExpression ] + Return empty. +---*/ + +var x = "/*{ propname }*/"; +class C { + /*{ static }*/ [x]; +} + +var c = new C(); + +assert.sameValue(c.hasOwnProperty("/*{ propname }*/"), true); diff --git a/src/class-fields/propname-error/cls-decl-literal-name.template b/src/class-fields/propname-error/cls-decl-literal-name.template new file mode 100644 index 000000000..3c4ce9e9e --- /dev/null +++ b/src/class-fields/propname-error/cls-decl-literal-name.template @@ -0,0 +1,21 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions-static-semantics-early-errors +path: language/statements/class/fields-literal-name- +name: early error -- PropName of IdentifierName is forbidden value +negative: + type: SyntaxError + phase: early +info: | + Static Semantics: PropName + LiteralPropertyName : IdentifierName + Return StringValue of IdentifierName. +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + /*{ static }*/ /*{ propname }*/; +} diff --git a/src/class-fields/propname-error/cls-decl-string-name.template b/src/class-fields/propname-error/cls-decl-string-name.template new file mode 100644 index 000000000..743f20f74 --- /dev/null +++ b/src/class-fields/propname-error/cls-decl-string-name.template @@ -0,0 +1,22 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions-static-semantics-early-errors +path: language/statements/class/fields-string-name- +name: early error -- PropName of StringLiteral is forbidden value +negative: + type: SyntaxError + phase: early +info: | + Static Semantics: PropName + ... + LiteralPropertyName : StringLiteral + Return the String value whose code units are the SV of the StringLiteral. +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + /*{ static }*/ '/*{ propname }*/'; +} diff --git a/src/class-fields/propname-error/cls-decl-variable-name.template b/src/class-fields/propname-error/cls-decl-variable-name.template new file mode 100644 index 000000000..cbda5b831 --- /dev/null +++ b/src/class-fields/propname-error/cls-decl-variable-name.template @@ -0,0 +1,22 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions-static-semantics-early-errors +path: language/statements/class/fields-computed-variable-name- +name: no early error -- PropName of ComputedPropertyName not forbidden value +info: | + Static Semantics: PropName + ... + ComputedPropertyName : [ AssignmentExpression ] + Return empty. +---*/ + +var /*{ propname }*/ = 'foo'; +class C { + /*{ static }*/ [/*{ propname }*/]; +} + +var c = new C(); + +assert.sameValue(c.hasOwnProperty("foo"), true); diff --git a/src/class-fields/propname-error/cls-expr-computed-name.template b/src/class-fields/propname-error/cls-expr-computed-name.template new file mode 100644 index 000000000..e509263ee --- /dev/null +++ b/src/class-fields/propname-error/cls-expr-computed-name.template @@ -0,0 +1,22 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions-static-semantics-early-errors +path: language/expressions/class/fields-computed-name- +name: no early error -- PropName of ComputedPropertyName not forbidden value +info: | + Static Semantics: PropName + ... + ComputedPropertyName : [ AssignmentExpression ] + Return empty. +---*/ + +var x = "/*{ propname }*/"; +var C = class { + /*{ static }*/ [x]; +} + +var c = new C(); + +assert.sameValue(c.hasOwnProperty("/*{ propname }*/"), true); diff --git a/src/class-fields/propname-error/cls-expr-literal-name.template b/src/class-fields/propname-error/cls-expr-literal-name.template new file mode 100644 index 000000000..bd87b81d2 --- /dev/null +++ b/src/class-fields/propname-error/cls-expr-literal-name.template @@ -0,0 +1,21 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions-static-semantics-early-errors +path: language/expressions/class/fields-literal-name- +name: early error -- PropName of IdentifierName is forbidden +negative: + type: SyntaxError + phase: early +info: | + Static Semantics: PropName + LiteralPropertyName : IdentifierName + Return StringValue of IdentifierName. +---*/ + +throw "Test262: This statement should not be evaluated."; + +var C = class { + /*{ static }*/ /*{ propname }*/; +} diff --git a/src/class-fields/propname-error/cls-expr-string-name.template b/src/class-fields/propname-error/cls-expr-string-name.template new file mode 100644 index 000000000..189a1bd80 --- /dev/null +++ b/src/class-fields/propname-error/cls-expr-string-name.template @@ -0,0 +1,22 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions-static-semantics-early-errors +path: language/expressions/class/fields-string-name- +name: early error -- PropName of StringLiteral is forbidden +negative: + type: SyntaxError + phase: early +info: | + Static Semantics: PropName + ... + LiteralPropertyName : StringLiteral + Return the String value whose code units are the SV of the StringLiteral. +---*/ + +throw "Test262: This statement should not be evaluated."; + +var C = class { + /*{ static }*/ '/*{ propname }*/'; +} diff --git a/src/class-fields/propname-error/cls-expr-variable-name.template b/src/class-fields/propname-error/cls-expr-variable-name.template new file mode 100644 index 000000000..50b255197 --- /dev/null +++ b/src/class-fields/propname-error/cls-expr-variable-name.template @@ -0,0 +1,22 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions-static-semantics-early-errors +path: language/expressions/class/fields-computed-variable-name- +name: no early error -- PropName of ComputedPropertyName not forbidden value +info: | + Static Semantics: PropName + ... + ComputedPropertyName : [ AssignmentExpression ] + Return empty. +---*/ + +var /*{ propname }*/ = 'foo'; +var C = class { + /*{ static }*/ [/*{ propname }*/]; +} + +var c = new C(); + +assert.sameValue(c.hasOwnProperty("foo"), true); diff --git a/src/class-fields/static-propname-constructor.case b/src/class-fields/static-propname-constructor.case new file mode 100644 index 000000000..ff3d00af6 --- /dev/null +++ b/src/class-fields/static-propname-constructor.case @@ -0,0 +1,20 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: static class field forbid PropName 'constructor' +info: | + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : staticFieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor". +features: [class-fields] +template: propname-error +---*/ + +//- static +static +//- propname +constructor diff --git a/src/class-fields/static-propname-prototype.case b/src/class-fields/static-propname-prototype.case new file mode 100644 index 000000000..99d85ff64 --- /dev/null +++ b/src/class-fields/static-propname-prototype.case @@ -0,0 +1,20 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: static class fields forbid PropName 'prototype' +info: | + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : staticFieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor". +features: [class-fields] +template: propname-error +---*/ + +//- static +static +//- propname +prototype |