From f2d76e60f27fa96d494a9d77e44ff04db44276ed Mon Sep 17 00:00:00 2001
From: Valerie R Young <spectranaut@riseup.net>
Date: Thu, 12 Oct 2017 17:30:16 -0400
Subject: [PATCH] class fields: add early errors for argument and super

# Conflicts:
#	src/class-fields/init-err-contains-super.case
---
 .../init-err-contains-boolean.case            | 28 +++++++++++++++++++
 .../cls-decl-fields-comp-name.template        | 15 ++++++++++
 .../cls-decl-fields-static-comp-name.template | 15 ++++++++++
 ...s-decl-fields-static-literal-name.template | 14 ++++++++++
 ...fields-static-string-literal-name.template | 14 ++++++++++
 .../cls-expr-fields-static-comp-name.template | 15 ++++++++++
 ...s-expr-fields-static-literal-name.template | 14 ++++++++++
 ...fields-static-string-literal-name.template | 14 ++++++++++
 8 files changed, 129 insertions(+)
 create mode 100644 src/class-fields/init-err-contains-boolean.case
 create mode 100644 src/class-fields/initializer-error/cls-decl-fields-comp-name.template
 create mode 100644 src/class-fields/initializer-error/cls-decl-fields-static-comp-name.template
 create mode 100644 src/class-fields/initializer-error/cls-decl-fields-static-literal-name.template
 create mode 100644 src/class-fields/initializer-error/cls-decl-fields-static-string-literal-name.template
 create mode 100644 src/class-fields/initializer-error/cls-expr-fields-static-comp-name.template
 create mode 100644 src/class-fields/initializer-error/cls-expr-fields-static-literal-name.template
 create mode 100644 src/class-fields/initializer-error/cls-expr-fields-static-string-literal-name.template

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/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-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-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 }*/;
+}
-- 
GitLab