summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Ehrenberg <littledan@chromium.org>2017-07-13 21:10:41 +0200
committerLeo Balter <leonardo.balter@gmail.com>2017-08-24 14:11:27 -0400
commitf3f3b473064abfeb4ebc1fc322382028e82147a6 (patch)
tree0d9f1c7b00ab2b31b73751815047b9b471719a5e /src
parentf1d7a67e11cf5fb89b94894f46e10796c6248b38 (diff)
downloadqtdeclarative-testsuites-f3f3b473064abfeb4ebc1fc322382028e82147a6.tar.gz
Refactor class fields templates and cases
Diffstat (limited to 'src')
-rw-r--r--src/class-fields/computed-names.case70
-rw-r--r--src/class-fields/computed-symbol-names.case55
-rw-r--r--src/class-fields/conventions.md8
-rw-r--r--src/class-fields/default/cls-decl-after-same-line-async-gen.template30
-rw-r--r--src/class-fields/default/cls-decl-after-same-line-async-method.template30
-rw-r--r--src/class-fields/default/cls-decl-after-same-line-gen.template26
-rw-r--r--src/class-fields/default/cls-decl-after-same-line-method.template26
-rw-r--r--src/class-fields/default/cls-decl-after-same-line-static-async-gen.template30
-rw-r--r--src/class-fields/default/cls-decl-after-same-line-static-async-method.template30
-rw-r--r--src/class-fields/default/cls-decl-after-same-line-static-gen.template26
-rw-r--r--src/class-fields/default/cls-decl-after-same-line-static-method.template26
-rw-r--r--src/class-fields/default/cls-decl-multiple-definitions.template62
-rw-r--r--src/class-fields/default/cls-decl-multiple-stacked-definitions.template44
-rw-r--r--src/class-fields/default/cls-decl-new-no-sc-line-method.template27
-rw-r--r--src/class-fields/default/cls-decl-new-sc-line-generator.template27
-rw-r--r--src/class-fields/default/cls-decl-new-sc-line-method.template27
-rw-r--r--src/class-fields/default/cls-decl-regular-definitions.template16
-rw-r--r--src/class-fields/default/cls-decl-same-line-generator.template26
-rw-r--r--src/class-fields/default/cls-decl-same-line-method.template26
-rw-r--r--src/class-fields/default/cls-decl-wrapped-in-sc.template18
-rw-r--r--src/class-fields/default/cls-expr-after-same-line-async-gen.template30
-rw-r--r--src/class-fields/default/cls-expr-after-same-line-async-method.template30
-rw-r--r--src/class-fields/default/cls-expr-after-same-line-gen.template26
-rw-r--r--src/class-fields/default/cls-expr-after-same-line-method.template26
-rw-r--r--src/class-fields/default/cls-expr-after-same-line-static-async-gen.template30
-rw-r--r--src/class-fields/default/cls-expr-after-same-line-static-async-method.template30
-rw-r--r--src/class-fields/default/cls-expr-after-same-line-static-gen.template26
-rw-r--r--src/class-fields/default/cls-expr-after-same-line-static-method.template26
-rw-r--r--src/class-fields/default/cls-expr-multiple-definitions.template62
-rw-r--r--src/class-fields/default/cls-expr-multiple-stacked-definitions.template44
-rw-r--r--src/class-fields/default/cls-expr-new-no-sc-line-method.template27
-rw-r--r--src/class-fields/default/cls-expr-new-sc-line-generator.template27
-rw-r--r--src/class-fields/default/cls-expr-new-sc-line-method.template27
-rw-r--r--src/class-fields/default/cls-expr-regular-definitions.template16
-rw-r--r--src/class-fields/default/cls-expr-same-line-generator.template26
-rw-r--r--src/class-fields/default/cls-expr-same-line-method.template26
-rw-r--r--src/class-fields/default/cls-expr-wrapped-in-sc.template18
-rw-r--r--src/class-fields/error/cls-decl-new-no-sc-line-generator.template16
-rw-r--r--src/class-fields/info.txt16
-rw-r--r--src/class-fields/literal-names.case57
-rw-r--r--src/class-fields/static-computed-names.case40
-rw-r--r--src/class-fields/static-computed-symbol-names.case55
-rw-r--r--src/class-fields/static-literal-names.case57
-rw-r--r--src/class-fields/string-literal-names.case33
44 files changed, 1401 insertions, 0 deletions
diff --git a/src/class-fields/computed-names.case b/src/class-fields/computed-names.case
new file mode 100644
index 000000000..fcfaf5321
--- /dev/null
+++ b/src/class-fields/computed-names.case
@@ -0,0 +1,70 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-FieldDefinition
+desc: Computed property names
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+template: default
+includes: [propertyHelper.js]
+features: [computed-property-names]
+---*/
+
+//- setup
+var x = "b";
+
+//- fields
+static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]
+//- assertions
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
+assert.sameValue(Object.hasOwnProperty.call(c, "a"), false);
+
+verifyProperty(C, "a", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "x"), false);
+assert.sameValue(Object.hasOwnProperty.call(c, "x"), false);
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "10"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "10"), false);
+
+verifyProperty(c, "10", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false);
+
+verifyProperty(c, "not initialized", {
+ value: "meep",
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
diff --git a/src/class-fields/computed-symbol-names.case b/src/class-fields/computed-symbol-names.case
new file mode 100644
index 000000000..9a7aec851
--- /dev/null
+++ b/src/class-fields/computed-symbol-names.case
@@ -0,0 +1,55 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-FieldDefinition
+desc: Computed property symbol names
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+template: default
+includes: [propertyHelper.js]
+features: [Symbol, computed-property-names]
+---*/
+
+//- setup
+var x = Symbol();
+var y = Symbol();
+
+//- fields
+[x]; [y] = 42
+//- assertions
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
+assert.sameValue(Object.hasOwnProperty.call(C, x), false);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
+assert.sameValue(Object.hasOwnProperty.call(C, y), false);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "x"), false);
+assert.sameValue(Object.hasOwnProperty.call(c, "x"), false);
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "y"), false);
+assert.sameValue(Object.hasOwnProperty.call(c, "y"), false);
diff --git a/src/class-fields/conventions.md b/src/class-fields/conventions.md
new file mode 100644
index 000000000..b7fbee91b
--- /dev/null
+++ b/src/class-fields/conventions.md
@@ -0,0 +1,8 @@
+# Conventions for the class fields templates and cases
+
+Templates should produce a class named `C` and instantiate it to an object named `c`.
+
+## Known template fields:
+
+* fields: it should contain the list of class fields, inserted in the class body. Please, avoid closing a field with a trailing semi-colon, this might prevent ASI checks properly.
+* assertions: it should contain the assertions to run after the class object is instantiated.
diff --git a/src/class-fields/default/cls-decl-after-same-line-async-gen.template b/src/class-fields/default/cls-decl-after-same-line-async-gen.template
new file mode 100644
index 000000000..49983da69
--- /dev/null
+++ b/src/class-fields/default/cls-decl-after-same-line-async-gen.template
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-same-line-async-gen-
+name: field definitions after an async generator in the same line
+features: [class-fields, async-iteration]
+flags: [async]
+---*/
+
+class C {
+ async *m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
+
+c.m().next().then(function(v) {
+ assert.sameValue(v, 42);
+}, $DONE).then($DONE, $DONE);
diff --git a/src/class-fields/default/cls-decl-after-same-line-async-method.template b/src/class-fields/default/cls-decl-after-same-line-async-method.template
new file mode 100644
index 000000000..a261640dd
--- /dev/null
+++ b/src/class-fields/default/cls-decl-after-same-line-async-method.template
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-same-line-async-method-
+name: field definitions after an async method in the same line
+features: [class-fields, async-functions]
+flags: [async]
+---*/
+
+class C {
+ async m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+}, $DONE).then($DONE, $DONE);
diff --git a/src/class-fields/default/cls-decl-after-same-line-gen.template b/src/class-fields/default/cls-decl-after-same-line-gen.template
new file mode 100644
index 000000000..e96d4e9ea
--- /dev/null
+++ b/src/class-fields/default/cls-decl-after-same-line-gen.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-after-same-line-gen-
+name: field definitions after a generator in the same line
+features: [class-fields]
+---*/
+
+class C {
+ *m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-after-same-line-method.template b/src/class-fields/default/cls-decl-after-same-line-method.template
new file mode 100644
index 000000000..1ac0fa6ea
--- /dev/null
+++ b/src/class-fields/default/cls-decl-after-same-line-method.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-after-same-line-method-
+name: field definitions after a method in the same line
+features: [class-fields]
+---*/
+
+class C {
+ m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-after-same-line-static-async-gen.template b/src/class-fields/default/cls-decl-after-same-line-static-async-gen.template
new file mode 100644
index 000000000..5d5ad3f3e
--- /dev/null
+++ b/src/class-fields/default/cls-decl-after-same-line-static-async-gen.template
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-after-same-line-static-async-gen-
+name: field definitions after a static async generator in the same line
+features: [class-fields, async-iteration]
+flags: [async]
+---*/
+
+class C {
+ static async *m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
+
+C.m().next().then(function(v) {
+ assert.sameValue(v, 42);
+}, $DONE).then($DONE, $DONE);
diff --git a/src/class-fields/default/cls-decl-after-same-line-static-async-method.template b/src/class-fields/default/cls-decl-after-same-line-static-async-method.template
new file mode 100644
index 000000000..f83605e61
--- /dev/null
+++ b/src/class-fields/default/cls-decl-after-same-line-static-async-method.template
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-after-same-line-static-async-method-
+name: field definitions after a static async method in the same line
+features: [class-fields, async-functions]
+flags: [async]
+---*/
+
+class C {
+ static async m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+}, $DONE).then($DONE, $DONE);
diff --git a/src/class-fields/default/cls-decl-after-same-line-static-gen.template b/src/class-fields/default/cls-decl-after-same-line-static-gen.template
new file mode 100644
index 000000000..31f7ac678
--- /dev/null
+++ b/src/class-fields/default/cls-decl-after-same-line-static-gen.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-after-same-line-static-gen-
+name: field definitions after a static generator in the same line
+features: [class-fields]
+---*/
+
+class C {
+ static *m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-after-same-line-static-method.template b/src/class-fields/default/cls-decl-after-same-line-static-method.template
new file mode 100644
index 000000000..5b828cc60
--- /dev/null
+++ b/src/class-fields/default/cls-decl-after-same-line-static-method.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-after-same-line-static-method-
+name: field definitions after a static method in the same line
+features: [class-fields]
+---*/
+
+class C {
+ static m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-multiple-definitions.template b/src/class-fields/default/cls-decl-multiple-definitions.template
new file mode 100644
index 000000000..4aaa9f306
--- /dev/null
+++ b/src/class-fields/default/cls-decl-multiple-definitions.template
@@ -0,0 +1,62 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-multiple-definitions-
+name: multiple fields definitions
+features: [class-fields]
+---*/
+
+class C {
+ foo = "foobar";
+ m() { return 42 }
+ /*{ fields }*/
+ m2() { return 39 }
+ bar = "barbaz";
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-multiple-stacked-definitions.template b/src/class-fields/default/cls-decl-multiple-stacked-definitions.template
new file mode 100644
index 000000000..d078ed5c0
--- /dev/null
+++ b/src/class-fields/default/cls-decl-multiple-stacked-definitions.template
@@ -0,0 +1,44 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-multiple-stacked-definitions-
+name: multiple stacked fields definitions through ASI
+features: [class-fields]
+---*/
+
+class C {
+ /*{ fields }*/
+ foo = "foobar"
+ bar = "barbaz";
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+assert.sameValue(c.foo, "foobar");
+assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-new-no-sc-line-method.template b/src/class-fields/default/cls-decl-new-no-sc-line-method.template
new file mode 100644
index 000000000..a33cab62e
--- /dev/null
+++ b/src/class-fields/default/cls-decl-new-no-sc-line-method.template
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-new-no-sc-line-method-
+name: field definitions followed by a method in a new line without a semicolon
+features: [class-fields]
+---*/
+
+class C {
+ /*{ fields }*/
+ m() { return 42; }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-new-sc-line-generator.template b/src/class-fields/default/cls-decl-new-sc-line-generator.template
new file mode 100644
index 000000000..c124d126e
--- /dev/null
+++ b/src/class-fields/default/cls-decl-new-sc-line-generator.template
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-new-sc-line-gen-
+name: field definitions followed by a method in a new line with a semicolon
+features: [class-fields, generators]
+---*/
+
+class C {
+ /*{ fields }*/;
+ *m() { return 42; }
+}
+
+var c = new C();
+
+assert.sameValue(c.g().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-new-sc-line-method.template b/src/class-fields/default/cls-decl-new-sc-line-method.template
new file mode 100644
index 000000000..27349f228
--- /dev/null
+++ b/src/class-fields/default/cls-decl-new-sc-line-method.template
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-new-sc-line-method-
+name: field definitions followed by a method in a new line with a semicolon
+features: [class-fields]
+---*/
+
+class C {
+ /*{ fields }*/;
+ m() { return 42; }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-regular-definitions.template b/src/class-fields/default/cls-decl-regular-definitions.template
new file mode 100644
index 000000000..1ba379ad2
--- /dev/null
+++ b/src/class-fields/default/cls-decl-regular-definitions.template
@@ -0,0 +1,16 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-regular-definitions-
+name: regular fields defintion
+features: [class-fields]
+---*/
+
+class C {
+ /*{ fields }*/
+}
+
+var c = new C();
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-same-line-generator.template b/src/class-fields/default/cls-decl-same-line-generator.template
new file mode 100644
index 000000000..c7067477e
--- /dev/null
+++ b/src/class-fields/default/cls-decl-same-line-generator.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-same-line-gen-
+name: field definitions followed by a generator method in the same line
+features: [class-fields, generators]
+---*/
+
+class C {
+ /*{ fields }*/; *m() { return 42; }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-same-line-method.template b/src/class-fields/default/cls-decl-same-line-method.template
new file mode 100644
index 000000000..2c1eb9bfa
--- /dev/null
+++ b/src/class-fields/default/cls-decl-same-line-method.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-same-line-method-
+name: field definitions followed by a method in the same line
+features: [class-fields]
+---*/
+
+class C {
+ /*{ fields }*/; m() { return 42; }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-decl-wrapped-in-sc.template b/src/class-fields/default/cls-decl-wrapped-in-sc.template
new file mode 100644
index 000000000..421f4b4ad
--- /dev/null
+++ b/src/class-fields/default/cls-decl-wrapped-in-sc.template
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-wrapped-in-sc-
+name: fields definition wrapped in semicolons
+features: [class-fields]
+---*/
+
+class C {
+ ;;;;
+ ;;;;;;/*{ fields }*/;;;;;;;
+ ;;;;
+}
+
+var c = new C();
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-after-same-line-async-gen.template b/src/class-fields/default/cls-expr-after-same-line-async-gen.template
new file mode 100644
index 000000000..4d5b11967
--- /dev/null
+++ b/src/class-fields/default/cls-expr-after-same-line-async-gen.template
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-same-line-async-gen-
+name: field definitions after an async generator in the same line
+features: [class-fields, async-iteration]
+flags: [async]
+---*/
+
+var C = class {
+ async *m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
+
+c.m().next().then(function(v) {
+ assert.sameValue(v, 42);
+}, $DONE).then($DONE, $DONE);
diff --git a/src/class-fields/default/cls-expr-after-same-line-async-method.template b/src/class-fields/default/cls-expr-after-same-line-async-method.template
new file mode 100644
index 000000000..52a8356a9
--- /dev/null
+++ b/src/class-fields/default/cls-expr-after-same-line-async-method.template
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-same-line-async-method-
+name: field definitions after an async method in the same line
+features: [class-fields, async-functions]
+flags: [async]
+---*/
+
+var C = class {
+ async m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
+
+c.m().then(function(v) {
+ assert.sameValue(v, 42);
+}, $DONE).then($DONE, $DONE);
diff --git a/src/class-fields/default/cls-expr-after-same-line-gen.template b/src/class-fields/default/cls-expr-after-same-line-gen.template
new file mode 100644
index 000000000..5fc7c6486
--- /dev/null
+++ b/src/class-fields/default/cls-expr-after-same-line-gen.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-after-same-line-gen-
+name: field definitions after a generator in the same line
+features: [class-fields]
+---*/
+
+var C = class {
+ *m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-after-same-line-method.template b/src/class-fields/default/cls-expr-after-same-line-method.template
new file mode 100644
index 000000000..89c59504e
--- /dev/null
+++ b/src/class-fields/default/cls-expr-after-same-line-method.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-after-same-line-method-
+name: field definitions after a method in the same line
+features: [class-fields]
+---*/
+
+var C = class {
+ m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-after-same-line-static-async-gen.template b/src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
new file mode 100644
index 000000000..f1fdb4f45
--- /dev/null
+++ b/src/class-fields/default/cls-expr-after-same-line-static-async-gen.template
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-after-same-line-static-async-gen-
+name: field definitions after a static async generator in the same line
+features: [class-fields, async-iteration]
+flags: [async]
+---*/
+
+var C = class {
+ static async *m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
+
+C.m().next().then(function(v) {
+ assert.sameValue(v, 42);
+}, $DONE).then($DONE, $DONE);
diff --git a/src/class-fields/default/cls-expr-after-same-line-static-async-method.template b/src/class-fields/default/cls-expr-after-same-line-static-async-method.template
new file mode 100644
index 000000000..caa1f2f23
--- /dev/null
+++ b/src/class-fields/default/cls-expr-after-same-line-static-async-method.template
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-after-same-line-static-async-method-
+name: field definitions after a static async method in the same line
+features: [class-fields, async-functions]
+flags: [async]
+---*/
+
+var C = class {
+ static async m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
+
+C.m().then(function(v) {
+ assert.sameValue(v, 42);
+}, $DONE).then($DONE, $DONE);
diff --git a/src/class-fields/default/cls-expr-after-same-line-static-gen.template b/src/class-fields/default/cls-expr-after-same-line-static-gen.template
new file mode 100644
index 000000000..0caf1c692
--- /dev/null
+++ b/src/class-fields/default/cls-expr-after-same-line-static-gen.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-after-same-line-static-gen-
+name: field definitions after a static generator in the same line
+features: [class-fields]
+---*/
+
+var C = class {
+ static *m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(C.m().next().value, 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-after-same-line-static-method.template b/src/class-fields/default/cls-expr-after-same-line-static-method.template
new file mode 100644
index 000000000..1512059bb
--- /dev/null
+++ b/src/class-fields/default/cls-expr-after-same-line-static-method.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-after-same-line-static-method-
+name: field definitions after a static method in the same line
+features: [class-fields]
+---*/
+
+var C = class {
+ static m() { return 42; } /*{ fields }*/;
+}
+
+var c = new C();
+
+assert.sameValue(C.m(), 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false);
+
+verifyProperty(C, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-multiple-definitions.template b/src/class-fields/default/cls-expr-multiple-definitions.template
new file mode 100644
index 000000000..a5440f626
--- /dev/null
+++ b/src/class-fields/default/cls-expr-multiple-definitions.template
@@ -0,0 +1,62 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-multiple-definitions-
+name: multiple fields definitions
+features: [class-fields]
+---*/
+
+var C = class {
+ foo = "foobar";
+ m() { return 42 }
+ /*{ fields }*/
+ m2() { return 39 }
+ bar = "barbaz";
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.m2(), 39);
+assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false);
+assert.sameValue(c.m2, C.prototype.m2);
+
+verifyProperty(C.prototype, "m2", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.foo, "foobar");
+assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-multiple-stacked-definitions.template b/src/class-fields/default/cls-expr-multiple-stacked-definitions.template
new file mode 100644
index 000000000..bd0d63c78
--- /dev/null
+++ b/src/class-fields/default/cls-expr-multiple-stacked-definitions.template
@@ -0,0 +1,44 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-multiple-stacked-definitions-
+name: multiple stacked fields definitions through ASI
+features: [class-fields]
+---*/
+
+var C = class {
+ /*{ fields }*/
+ foo = "foobar"
+ bar = "barbaz";
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+assert.sameValue(c.m, C.prototype.m);
+
+assert.sameValue(c.foo, "foobar");
+assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false);
+
+verifyProperty(c, "foo", {
+ value: "foobar",
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+assert.sameValue(c.bar, "barbaz");
+assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false);
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false);
+
+verifyProperty(c, "bar", {
+ value: "barbaz",
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-new-no-sc-line-method.template b/src/class-fields/default/cls-expr-new-no-sc-line-method.template
new file mode 100644
index 000000000..62ba2d6d5
--- /dev/null
+++ b/src/class-fields/default/cls-expr-new-no-sc-line-method.template
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-new-no-sc-line-method-
+name: field definitions followed by a method in a new line without a semicolon
+features: [class-fields]
+---*/
+
+var C = class {
+ /*{ fields }*/
+ m() { return 42; }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-new-sc-line-generator.template b/src/class-fields/default/cls-expr-new-sc-line-generator.template
new file mode 100644
index 000000000..5ddf98c7c
--- /dev/null
+++ b/src/class-fields/default/cls-expr-new-sc-line-generator.template
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-new-sc-line-gen-
+name: field definitions followed by a method in a new line with a semicolon
+features: [class-fields, generators]
+---*/
+
+var C = class {
+ /*{ fields }*/;
+ *m() { return 42; }
+}
+
+var c = new C();
+
+assert.sameValue(c.g().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-new-sc-line-method.template b/src/class-fields/default/cls-expr-new-sc-line-method.template
new file mode 100644
index 000000000..f8e2e9c3b
--- /dev/null
+++ b/src/class-fields/default/cls-expr-new-sc-line-method.template
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-new-sc-line-method-
+name: field definitions followed by a method in a new line with a semicolon
+features: [class-fields]
+---*/
+
+var C = class {
+ /*{ fields }*/;
+ m() { return 42; }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-regular-definitions.template b/src/class-fields/default/cls-expr-regular-definitions.template
new file mode 100644
index 000000000..b00b9f3ff
--- /dev/null
+++ b/src/class-fields/default/cls-expr-regular-definitions.template
@@ -0,0 +1,16 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-regular-definitions-
+name: regular fields defintion
+features: [class-fields]
+---*/
+
+var C = class {
+ /*{ fields }*/
+}
+
+var c = new C();
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-same-line-generator.template b/src/class-fields/default/cls-expr-same-line-generator.template
new file mode 100644
index 000000000..7ac2f513a
--- /dev/null
+++ b/src/class-fields/default/cls-expr-same-line-generator.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-same-line-gen-
+name: field definitions followed by a generator method in the same line
+features: [class-fields, generators]
+---*/
+
+var C = class {
+ /*{ fields }*/; *m() { return 42; }
+}
+
+var c = new C();
+
+assert.sameValue(c.m().next().value, 42);
+assert.sameValue(c.m, C.prototype.m);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-same-line-method.template b/src/class-fields/default/cls-expr-same-line-method.template
new file mode 100644
index 000000000..ac26e16fb
--- /dev/null
+++ b/src/class-fields/default/cls-expr-same-line-method.template
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-same-line-method-
+name: field definitions followed by a method in the same line
+features: [class-fields]
+---*/
+
+var C = class {
+ /*{ fields }*/; m() { return 42; }
+}
+
+var c = new C();
+
+assert.sameValue(c.m(), 42);
+assert.sameValue(c.m, C.prototype.m);
+assert.sameValue(Object.hasOwnProperty.call(c, "m"), false);
+
+verifyProperty(C.prototype, "m", {
+ enumerable: false,
+ configurable: true,
+ writable: true,
+});
+
+/*{ assertions }*/
diff --git a/src/class-fields/default/cls-expr-wrapped-in-sc.template b/src/class-fields/default/cls-expr-wrapped-in-sc.template
new file mode 100644
index 000000000..648d38496
--- /dev/null
+++ b/src/class-fields/default/cls-expr-wrapped-in-sc.template
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/expressions/class/fields-wrapped-in-sc-
+name: fields definition wrapped in semicolons
+features: [class-fields]
+---*/
+
+var C = class {
+ ;;;;
+ ;;;;;;/*{ fields }*/;;;;;;;
+ ;;;;
+}
+
+var c = new C();
+
+/*{ assertions }*/
diff --git a/src/class-fields/error/cls-decl-new-no-sc-line-generator.template b/src/class-fields/error/cls-decl-new-no-sc-line-generator.template
new file mode 100644
index 000000000..c7aebcdef
--- /dev/null
+++ b/src/class-fields/error/cls-decl-new-no-sc-line-generator.template
@@ -0,0 +1,16 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+path: language/statements/class/fields-new-no-sc-line-gen-
+name: ASI prevents a following generator method
+features: [class-fields, generators]
+negative:
+ type: SyntaxError
+ phase: early
+---*/
+
+class C {
+ /*{ fields }*/
+ *m() { return 42; }
+}
diff --git a/src/class-fields/info.txt b/src/class-fields/info.txt
new file mode 100644
index 000000000..236a9a148
--- /dev/null
+++ b/src/class-fields/info.txt
@@ -0,0 +1,16 @@
+ ClassElement:
+ MethodDefinition
+ static MethodDefinition
+ FieldDefinition ;
+ static FieldDefinition ;
+ ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+ PrivateName
+
+ PrivateName ::
+ # IdentifierName \ No newline at end of file
diff --git a/src/class-fields/literal-names.case b/src/class-fields/literal-names.case
new file mode 100644
index 000000000..9237fd989
--- /dev/null
+++ b/src/class-fields/literal-names.case
@@ -0,0 +1,57 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-FieldDefinition
+desc: Literal property names
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+template: default
+includes: [propertyHelper.js]
+---*/
+
+//- setup
+const fn = function() {}
+
+//- fields
+a; b = 42;
+c = fn
+//- assertions
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "a"), false);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "c"), false);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
diff --git a/src/class-fields/static-computed-names.case b/src/class-fields/static-computed-names.case
new file mode 100644
index 000000000..25905f004
--- /dev/null
+++ b/src/class-fields/static-computed-names.case
@@ -0,0 +1,40 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-FieldDefinition
+desc: Static Computed property names
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+ static FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+template: default
+includes: [propertyHelper.js]
+features: [computed-property-names]
+---*/
+
+//- fields
+static ["a"] = 42; ["a"] = 39
+//- assertions
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
+
+verifyProperty(C, "a", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+verifyProperty(c, "a", {
+ value: 39,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
diff --git a/src/class-fields/static-computed-symbol-names.case b/src/class-fields/static-computed-symbol-names.case
new file mode 100644
index 000000000..32e10a368
--- /dev/null
+++ b/src/class-fields/static-computed-symbol-names.case
@@ -0,0 +1,55 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-FieldDefinition
+desc: Static computed property symbol names
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+template: default
+includes: [propertyHelper.js]
+features: [Symbol, computed-property-names]
+---*/
+
+//- setup
+var x = Symbol();
+var y = Symbol();
+
+//- fields
+[x]; [y] = 42
+//- assertions
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false);
+assert.sameValue(Object.hasOwnProperty.call(C, x), false);
+
+verifyProperty(c, x, {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false);
+assert.sameValue(Object.hasOwnProperty.call(C, y), false);
+
+verifyProperty(c, y, {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "x"), false);
+assert.sameValue(Object.hasOwnProperty.call(c, "x"), false);
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "y"), false);
+assert.sameValue(Object.hasOwnProperty.call(c, "y"), false);
diff --git a/src/class-fields/static-literal-names.case b/src/class-fields/static-literal-names.case
new file mode 100644
index 000000000..0bd040ed4
--- /dev/null
+++ b/src/class-fields/static-literal-names.case
@@ -0,0 +1,57 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-FieldDefinition
+desc: Static literal property names
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+template: default
+includes: [propertyHelper.js]
+---*/
+
+//- setup
+const fn = function() {}
+
+//- fields
+static a; b = 42;
+static c = fn
+//- assertions
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
+assert.sameValue(Object.hasOwnProperty.call(c, "a"), false);
+
+verifyProperty(C, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false);
+assert.sameValue(Object.hasOwnProperty.call(c, "c"), false);
+
+verifyProperty(C, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
diff --git a/src/class-fields/string-literal-names.case b/src/class-fields/string-literal-names.case
new file mode 100644
index 000000000..98e37d5d0
--- /dev/null
+++ b/src/class-fields/string-literal-names.case
@@ -0,0 +1,33 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-FieldDefinition
+desc: String literal names
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+template: default
+includes: [propertyHelper.js]
+---*/
+
+//- fields
+'a'; "b"; 'c' = 39;
+"d" = 42
+//- assertions
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "a"), false);
+
+verifyProperty(c, "a", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});