diff --git a/src/class-fields/init-err-contains-boolean.case b/src/class-fields/init-err-contains-boolean.case new file mode 100644 index 0000000000..605cdd32dd --- /dev/null +++ b/src/class-fields/init-err-contains-boolean.case @@ -0,0 +1,28 @@ +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: Syntax error if `arguments` used in class field +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. +features: [class-fields] +negative: + type: SyntaxError + phase: early +template: initializer-error +---*/ + +//- initializer +arguments diff --git a/src/class-fields/init-err-contains-super.case b/src/class-fields/init-err-contains-super.case new file mode 100644 index 0000000000..49aa3c9bff --- /dev/null +++ b/src/class-fields/init-err-contains-super.case @@ -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. + +/*--- +desc: Syntax error if `super()` used in class field +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. +features: [class-fields] +negative: + type: SyntaxError + phase: early +template: initializer-error +---*/ + +//- initializer +super() diff --git a/src/class-fields/initializer-error/cls-decl-fields-arrow-fnc.template b/src/class-fields/initializer-error/cls-decl-fields-arrow-fnc.template new file mode 100644 index 0000000000..308297a34a --- /dev/null +++ b/src/class-fields/initializer-error/cls-decl-fields-arrow-fnc.template @@ -0,0 +1,15 @@ +// 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-arrow-fnc- +name: arrow function expression +features: [arrow-function] +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + x = () => /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-decl-fields-comp-name.template b/src/class-fields/initializer-error/cls-decl-fields-comp-name.template new file mode 100644 index 0000000000..a922c25b80 --- /dev/null +++ b/src/class-fields/initializer-error/cls-decl-fields-comp-name.template @@ -0,0 +1,15 @@ +// 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-comp-name- +name: computed ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +var x = "string"; +class C { + static [x] = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-decl-fields-equality.template b/src/class-fields/initializer-error/cls-decl-fields-equality.template new file mode 100644 index 0000000000..0e5b643e11 --- /dev/null +++ b/src/class-fields/initializer-error/cls-decl-fields-equality.template @@ -0,0 +1,14 @@ +// 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-equality- +name: equality expression +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + x = {} == /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-decl-fields-literal-name.template b/src/class-fields/initializer-error/cls-decl-fields-literal-name.template new file mode 100644 index 0000000000..62060229fa --- /dev/null +++ b/src/class-fields/initializer-error/cls-decl-fields-literal-name.template @@ -0,0 +1,14 @@ +// 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: literal ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + x = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-decl-fields-static-comp-name.template b/src/class-fields/initializer-error/cls-decl-fields-static-comp-name.template new file mode 100644 index 0000000000..b4eb238479 --- /dev/null +++ b/src/class-fields/initializer-error/cls-decl-fields-static-comp-name.template @@ -0,0 +1,15 @@ +// 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-static-comp-name- +name: static computed ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +var x = "string"; +class C { + static [x] = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-decl-fields-static-literal-name.template b/src/class-fields/initializer-error/cls-decl-fields-static-literal-name.template new file mode 100644 index 0000000000..335d76793f --- /dev/null +++ b/src/class-fields/initializer-error/cls-decl-fields-static-literal-name.template @@ -0,0 +1,14 @@ +// 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-static-literal- +name: static literal ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + static x = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-decl-fields-static-string-literal-name.template b/src/class-fields/initializer-error/cls-decl-fields-static-string-literal-name.template new file mode 100644 index 0000000000..5fd801e187 --- /dev/null +++ b/src/class-fields/initializer-error/cls-decl-fields-static-string-literal-name.template @@ -0,0 +1,14 @@ +// 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-static-string-literal-name- +name: static string literal ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + static 'x' = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-decl-fields-string-literal-name.template b/src/class-fields/initializer-error/cls-decl-fields-string-literal-name.template new file mode 100644 index 0000000000..b76e487109 --- /dev/null +++ b/src/class-fields/initializer-error/cls-decl-fields-string-literal-name.template @@ -0,0 +1,14 @@ +// 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-literal-name- +name: string literal ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + 'x' = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-decl-fields-ternary.template b/src/class-fields/initializer-error/cls-decl-fields-ternary.template new file mode 100644 index 0000000000..db729e59c8 --- /dev/null +++ b/src/class-fields/initializer-error/cls-decl-fields-ternary.template @@ -0,0 +1,14 @@ +// 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-ternary- +name: ternary expression +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + x = false ? {} : /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-decl-fields-typeof.template b/src/class-fields/initializer-error/cls-decl-fields-typeof.template new file mode 100644 index 0000000000..86f5598b3b --- /dev/null +++ b/src/class-fields/initializer-error/cls-decl-fields-typeof.template @@ -0,0 +1,14 @@ +// 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-typeof- +name: typeof expression +---*/ + +throw "Test262: This statement should not be evaluated."; + +class C { + x = typeof /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-expr-fields-arrow-fnc.template b/src/class-fields/initializer-error/cls-expr-fields-arrow-fnc.template new file mode 100644 index 0000000000..0f20b4d9f8 --- /dev/null +++ b/src/class-fields/initializer-error/cls-expr-fields-arrow-fnc.template @@ -0,0 +1,15 @@ +// 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-arrow-fnc- +name: arrow function expression +features: [arrow-function] +---*/ + +throw "Test262: This statement should not be evaluated."; + +var C = class { + x = () => /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-expr-fields-comp-name.template b/src/class-fields/initializer-error/cls-expr-fields-comp-name.template new file mode 100644 index 0000000000..fea438412f --- /dev/null +++ b/src/class-fields/initializer-error/cls-expr-fields-comp-name.template @@ -0,0 +1,15 @@ +// 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-comp-name- +name: computed ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +var x = "string"; +var C = class { + [x] = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-expr-fields-equality.template b/src/class-fields/initializer-error/cls-expr-fields-equality.template new file mode 100644 index 0000000000..2946f8004d --- /dev/null +++ b/src/class-fields/initializer-error/cls-expr-fields-equality.template @@ -0,0 +1,14 @@ +// 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-equality- +name: equality expression +---*/ + +throw "Test262: This statement should not be evaluated."; + +var C = class { + x = {} == /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-expr-fields-literal-name.template b/src/class-fields/initializer-error/cls-expr-fields-literal-name.template new file mode 100644 index 0000000000..891e285274 --- /dev/null +++ b/src/class-fields/initializer-error/cls-expr-fields-literal-name.template @@ -0,0 +1,14 @@ +// 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: literal ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +var C = class { + x = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-expr-fields-static-comp-name.template b/src/class-fields/initializer-error/cls-expr-fields-static-comp-name.template new file mode 100644 index 0000000000..cb44207f4e --- /dev/null +++ b/src/class-fields/initializer-error/cls-expr-fields-static-comp-name.template @@ -0,0 +1,15 @@ +// 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-static-comp-name- +name: static computed ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +var x = "string"; +var C = class { + static [x] = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-expr-fields-static-literal-name.template b/src/class-fields/initializer-error/cls-expr-fields-static-literal-name.template new file mode 100644 index 0000000000..0a840e01ef --- /dev/null +++ b/src/class-fields/initializer-error/cls-expr-fields-static-literal-name.template @@ -0,0 +1,14 @@ +// 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-static-literal- +name: static literal ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +var C = class { + static x = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-expr-fields-static-string-literal-name.template b/src/class-fields/initializer-error/cls-expr-fields-static-string-literal-name.template new file mode 100644 index 0000000000..deed9b15e3 --- /dev/null +++ b/src/class-fields/initializer-error/cls-expr-fields-static-string-literal-name.template @@ -0,0 +1,14 @@ +// 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-static-string-literal-name- +name: static string literal ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +var C = class { + static 'x' = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-expr-fields-string-literal-name.template b/src/class-fields/initializer-error/cls-expr-fields-string-literal-name.template new file mode 100644 index 0000000000..1325036c0c --- /dev/null +++ b/src/class-fields/initializer-error/cls-expr-fields-string-literal-name.template @@ -0,0 +1,14 @@ +// 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-literal-name- +name: string literal ClassElementName +---*/ + +throw "Test262: This statement should not be evaluated."; + +var C = class { + 'x' = /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-expr-fields-ternary.template b/src/class-fields/initializer-error/cls-expr-fields-ternary.template new file mode 100644 index 0000000000..8dd67bed29 --- /dev/null +++ b/src/class-fields/initializer-error/cls-expr-fields-ternary.template @@ -0,0 +1,14 @@ +// 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-ternary- +name: ternary expression +---*/ + +throw "Test262: This statement should not be evaluated."; + +var C = class { + x = true ? {} : /*{ initializer }*/; +} diff --git a/src/class-fields/initializer-error/cls-expr-fields-typeof.template b/src/class-fields/initializer-error/cls-expr-fields-typeof.template new file mode 100644 index 0000000000..ec75561623 --- /dev/null +++ b/src/class-fields/initializer-error/cls-expr-fields-typeof.template @@ -0,0 +1,14 @@ +// 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-typeof- +name: typeof expression +---*/ + +throw "Test262: This statement should not be evaluated."; + +var C = class { + x = typeof /*{ initializer }*/; +}