diff options
author | Valerie R Young <spectranaut@riseup.net> | 2017-10-12 17:30:16 -0400 |
---|---|---|
committer | Valerie R Young <valerie@bocoup.com> | 2017-10-17 17:53:03 -0400 |
commit | 2ab51b3a7347f8b5216b7bfa26d0ab20cbc47f5e (patch) | |
tree | 260f990c876fd6d07e9dd85ad56df98682d7c8e8 /src | |
parent | 315eca2bbdfc9950045dc8467b3ccdf663611947 (diff) | |
download | qtdeclarative-testsuites-2ab51b3a7347f8b5216b7bfa26d0ab20cbc47f5e.tar.gz |
class fields: add early errors for argument and super
Diffstat (limited to 'src')
22 files changed, 335 insertions, 0 deletions
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 000000000..605cdd32d --- /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 000000000..49aa3c9bf --- /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 000000000..308297a34 --- /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 000000000..a922c25b8 --- /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 000000000..0e5b643e1 --- /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 000000000..62060229f --- /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 000000000..b4eb23847 --- /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 000000000..335d76793 --- /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 000000000..5fd801e18 --- /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 000000000..b76e48710 --- /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 000000000..db729e59c --- /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 000000000..86f5598b3 --- /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 000000000..0f20b4d9f --- /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 000000000..fea438412 --- /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 000000000..2946f8004 --- /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 000000000..891e28527 --- /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 000000000..cb44207f4 --- /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 000000000..0a840e01e --- /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 000000000..deed9b15e --- /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 000000000..1325036c0 --- /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 000000000..8dd67bed2 --- /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 000000000..ec7556162 --- /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 }*/; +} |