summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLeo Balter <leonardo.balter@gmail.com>2017-10-27 12:03:18 -0400
committerGitHub <noreply@github.com>2017-10-27 12:03:18 -0400
commitfafd46545401443435477743b924d3e203746967 (patch)
tree5670d56fef577c4a1b635c674588fd35ad35ba67 /src
parentf1602088e6f1277d89548dfacf46dbaa0fb98154 (diff)
parent0ad5eaf87c50ac7e856e9d99964e4e054f0eeb89 (diff)
downloadqtdeclarative-testsuites-fafd46545401443435477743b924d3e203746967.tar.gz
Merge pull request #1303 from bocoup/classfields
classfields: eval early errors
Diffstat (limited to 'src')
-rw-r--r--src/class-fields/eval-err-contains-arguments.case29
-rw-r--r--src/class-fields/eval-err-contains-newcall.case28
-rw-r--r--src/class-fields/eval-err-contains-supercall-1.case28
-rw-r--r--src/class-fields/eval-err-contains-supercall-2.case28
-rw-r--r--src/class-fields/eval-err-contains-supercall.case28
-rw-r--r--src/class-fields/eval-err-contains-superproperty-1.case28
-rw-r--r--src/class-fields/eval-err-contains-superproperty-2.case28
-rw-r--r--src/class-fields/initializer-eval-super/cls-decl-fields-eval.template21
-rw-r--r--src/class-fields/initializer-eval-super/cls-decl-fields-indirect-eval.template21
-rw-r--r--src/class-fields/initializer-eval-super/cls-expr-fields-eval.template21
-rw-r--r--src/class-fields/initializer-eval-super/cls-expr-fields-indirect-eval.template21
-rw-r--r--src/class-fields/initializer-eval/cls-decl-fields-eval.template19
-rw-r--r--src/class-fields/initializer-eval/cls-decl-fields-indirect-eval.template19
-rw-r--r--src/class-fields/initializer-eval/cls-expr-fields-eval.template19
-rw-r--r--src/class-fields/initializer-eval/cls-expr-fields-indirect-eval.template19
15 files changed, 357 insertions, 0 deletions
diff --git a/src/class-fields/eval-err-contains-arguments.case b/src/class-fields/eval-err-contains-arguments.case
new file mode 100644
index 000000000..7cf7fd2c6
--- /dev/null
+++ b/src/class-fields/eval-err-contains-arguments.case
@@ -0,0 +1,29 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+desc: error if `arguments` in StatementList of eval
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ It is a Syntax Error if ContainsArguments of StatementList 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]
+template: initializer-eval
+---*/
+
+//- initializer
+arguments
+//- earlyerror
+SyntaxError
+//- executionerror
+ReferenceError
diff --git a/src/class-fields/eval-err-contains-newcall.case b/src/class-fields/eval-err-contains-newcall.case
new file mode 100644
index 000000000..3b8eed5bc
--- /dev/null
+++ b/src/class-fields/eval-err-contains-newcall.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: error if `new.call` in StatementList of eval
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Functions
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
+ ScriptBody:StatementList
+
+ It is a Syntax Error if StatementList Contains NewTarget.
+features: [class-fields]
+template: initializer-eval
+---*/
+
+//- initializer
+new.call
+//- earlyerror
+SyntaxError
+//- executionerror
+SyntaxError
diff --git a/src/class-fields/eval-err-contains-supercall-1.case b/src/class-fields/eval-err-contains-supercall-1.case
new file mode 100644
index 000000000..eaabad6eb
--- /dev/null
+++ b/src/class-fields/eval-err-contains-supercall-1.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: error if `super()` in StatementList of eval
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody:StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+features: [class-fields]
+template: initializer-eval-super
+---*/
+
+//- initializer
+super()
+//- earlyerror
+SyntaxError
+//- executionerror
+SyntaxError
diff --git a/src/class-fields/eval-err-contains-supercall-2.case b/src/class-fields/eval-err-contains-supercall-2.case
new file mode 100644
index 000000000..45166f164
--- /dev/null
+++ b/src/class-fields/eval-err-contains-supercall-2.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: error if `super().x` in StatementList of eval
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody:StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+features: [class-fields]
+template: initializer-eval-super
+---*/
+
+//- initializer
+super().x
+//- earlyerror
+SyntaxError
+//- executionerror
+SyntaxError
diff --git a/src/class-fields/eval-err-contains-supercall.case b/src/class-fields/eval-err-contains-supercall.case
new file mode 100644
index 000000000..eaabad6eb
--- /dev/null
+++ b/src/class-fields/eval-err-contains-supercall.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: error if `super()` in StatementList of eval
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Constructor Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
+ ScriptBody:StatementList
+
+ It is a Syntax Error if StatementList Contains SuperCall.
+features: [class-fields]
+template: initializer-eval-super
+---*/
+
+//- initializer
+super()
+//- earlyerror
+SyntaxError
+//- executionerror
+SyntaxError
diff --git a/src/class-fields/eval-err-contains-superproperty-1.case b/src/class-fields/eval-err-contains-superproperty-1.case
new file mode 100644
index 000000000..7af5c8144
--- /dev/null
+++ b/src/class-fields/eval-err-contains-superproperty-1.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: error if `super().x` in StatementList of eval
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody:StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+features: [class-fields]
+template: initializer-eval-super
+---*/
+
+//- initializer
+super.x
+//- earlyerror
+SyntaxError
+//- executionerror
+SyntaxError
diff --git a/src/class-fields/eval-err-contains-superproperty-2.case b/src/class-fields/eval-err-contains-superproperty-2.case
new file mode 100644
index 000000000..21a3db544
--- /dev/null
+++ b/src/class-fields/eval-err-contains-superproperty-2.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: error if `super().x` in StatementList of eval
+info: |
+ Additional Early Error Rules for Eval Inside Initializer
+ These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
+ ScriptBody : StatementList
+
+ ...
+ The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
+
+ Additional Early Error Rules for Eval Outside Methods
+ These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
+ ScriptBody:StatementList
+
+ It is a Syntax Error if StatementList Contains SuperProperty.
+features: [class-fields]
+template: initializer-eval-super
+---*/
+
+//- initializer
+super['x']
+//- earlyerror
+SyntaxError
+//- executionerror
+SyntaxError
diff --git a/src/class-fields/initializer-eval-super/cls-decl-fields-eval.template b/src/class-fields/initializer-eval-super/cls-decl-fields-eval.template
new file mode 100644
index 000000000..101cf30b3
--- /dev/null
+++ b/src/class-fields/initializer-eval-super/cls-decl-fields-eval.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-performeval-rules-in-initializer
+path: language/statements/class/fields-derived-cls-direct-
+name: direct eval
+---*/
+
+class A = {}
+
+var executed = false;
+class C extends A = {
+ x = eval('executed = true; /*{ initializer }*/;';
+}
+
+assert.throws(/*{ earlyerror }*/, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
diff --git a/src/class-fields/initializer-eval-super/cls-decl-fields-indirect-eval.template b/src/class-fields/initializer-eval-super/cls-decl-fields-indirect-eval.template
new file mode 100644
index 000000000..9d77186bf
--- /dev/null
+++ b/src/class-fields/initializer-eval-super/cls-decl-fields-indirect-eval.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-performeval-rules-in-initializer
+path: language/statements/class/fields-derived-cls-indirect-
+name: indirect eval
+---*/
+
+class A = {}
+
+var executed = false;
+class C extends A = {
+ x = (0, eval)('executed = true; /*{ initializer }*/;';
+}
+
+assert.throws(/*{ executionerror }*/, function() {
+ new C();
+});
+
+assert.sameValue(executed, true);
diff --git a/src/class-fields/initializer-eval-super/cls-expr-fields-eval.template b/src/class-fields/initializer-eval-super/cls-expr-fields-eval.template
new file mode 100644
index 000000000..39597e880
--- /dev/null
+++ b/src/class-fields/initializer-eval-super/cls-expr-fields-eval.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-performeval-rules-in-initializer
+path: language/expressions/class/fields-derived-cls-direct-
+name: direct eval
+---*/
+
+A = class {}
+
+var executed = false;
+C = class extends A {
+ x = eval('executed = true; /*{ initializer }*/;';
+}
+
+assert.throws(/*{ earlyerror }*/, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
diff --git a/src/class-fields/initializer-eval-super/cls-expr-fields-indirect-eval.template b/src/class-fields/initializer-eval-super/cls-expr-fields-indirect-eval.template
new file mode 100644
index 000000000..86db54edb
--- /dev/null
+++ b/src/class-fields/initializer-eval-super/cls-expr-fields-indirect-eval.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-performeval-rules-in-initializer
+path: language/expressions/class/fields-derived-cls-indirect-
+name: indirect eval
+---*/
+
+A = class {}
+
+var executed = false;
+C = class extends A {
+ x = (0, eval)('executed = true; /*{ initializer }*/;';
+}
+
+assert.throws(/*{ executionerror }*/, function() {
+ new C();
+});
+
+assert.sameValue(executed, true);
diff --git a/src/class-fields/initializer-eval/cls-decl-fields-eval.template b/src/class-fields/initializer-eval/cls-decl-fields-eval.template
new file mode 100644
index 000000000..ed721afeb
--- /dev/null
+++ b/src/class-fields/initializer-eval/cls-decl-fields-eval.template
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-performeval-rules-in-initializer
+path: language/statements/class/fields-direct-
+name: direct eval
+---*/
+
+var executed = false;
+class C = {
+ x = eval('executed = true; /*{ initializer }*/;');
+}
+
+assert.throws(/*{ earlyerror }*/, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
diff --git a/src/class-fields/initializer-eval/cls-decl-fields-indirect-eval.template b/src/class-fields/initializer-eval/cls-decl-fields-indirect-eval.template
new file mode 100644
index 000000000..11aa34d0d
--- /dev/null
+++ b/src/class-fields/initializer-eval/cls-decl-fields-indirect-eval.template
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-performeval-rules-in-initializer
+path: language/statements/class/fields-indirect-
+name: indirect eval
+---*/
+
+var executed = false;
+class C = {
+ x = (0, eval)('executed = true; /*{ initializer }*/;');
+}
+
+assert.throws(/*{ executionerror }*/, function() {
+ new C();
+});
+
+assert.sameValue(executed, true);
diff --git a/src/class-fields/initializer-eval/cls-expr-fields-eval.template b/src/class-fields/initializer-eval/cls-expr-fields-eval.template
new file mode 100644
index 000000000..9915d0d09
--- /dev/null
+++ b/src/class-fields/initializer-eval/cls-expr-fields-eval.template
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-performeval-rules-in-initializer
+path: language/expressions/class/fields-direct-
+name: direct eval
+---*/
+
+var executed = false;
+C = class {
+ x = eval('executed = true; /*{ initializer }*/;');
+}
+
+assert.throws(/*{ earlyerror }*/, function() {
+ new C();
+});
+
+assert.sameValue(executed, false);
diff --git a/src/class-fields/initializer-eval/cls-expr-fields-indirect-eval.template b/src/class-fields/initializer-eval/cls-expr-fields-indirect-eval.template
new file mode 100644
index 000000000..d04a83dfb
--- /dev/null
+++ b/src/class-fields/initializer-eval/cls-expr-fields-indirect-eval.template
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-performeval-rules-in-initializer
+path: language/expressions/class/fields-indirect-
+name: indirect eval
+---*/
+
+var executed = false;
+C = class {
+ x = (0, eval)('executed = true; /*{ initializer }*/;');
+}
+
+assert.throws(/*{ executionerror }*/, function() {
+ new C();
+});
+
+assert.sameValue(executed, true);