Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: test/cctest/test-parsing.cc

Issue 1105453002: Revert of [strong] checking of this & super in constructors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/preparser.cc ('k') | test/mjsunit/strong/classes.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index ba842587708dfaaa8053883460b2e2e41f8bdf7f..86e042eced4ddf856bba7eacf7ae0bdde96f124f 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -5866,109 +5866,33 @@
}
-TEST(StrongConstructorThis) {
+TEST(StrongSuperCalls) {
const char* sloppy_context_data[][2] = {{"", ""}, {NULL}};
const char* strict_context_data[][2] = {{"'use strict';", ""}, {NULL}};
const char* strong_context_data[][2] = {{"'use strong';", ""}, {NULL}};
- const char* error_data[] = {
- "class C { constructor() { this; } }",
- "class C { constructor() { this.a; } }",
- "class C { constructor() { this['a']; } }",
- "class C { constructor() { (this); } }",
- "class C { constructor() { this(); } }",
- // TODO(rossberg): arrow functions not handled yet.
- // "class C { constructor() { () => this; } }",
- "class C { constructor() { this.a = 0, 0; } }",
- "class C { constructor() { (this.a = 0); } }",
- // "class C { constructor() { (() => this.a = 0)(); } }",
- "class C { constructor() { { this.a = 0; } } }",
- "class C { constructor() { if (1) this.a = 0; } }",
- "class C { constructor() { label: this.a = 0; } }",
- "class C { constructor() { this.a = this.b; } }",
- "class C { constructor() { this.a = {b: 1}; this.a.b } }",
- "class C { constructor() { this.a = {b: 1}; this.a.b = 0 } }",
- "class C { constructor() { this.a = function(){}; this.a() } }",
- NULL};
-
- const char* success_data[] = {
- "class C { constructor() { this.a = 0; } }",
- "class C { constructor() { label: 0; this.a = 0; this.b = 6; } }",
- NULL};
-
- static const ParserFlag always_flags[] = {
- kAllowStrongMode, kAllowHarmonyClasses, kAllowHarmonyObjectLiterals,
- kAllowHarmonyArrowFunctions
- };
- RunParserSyncTest(sloppy_context_data, error_data, kError, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strict_context_data, error_data, kSuccess, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strong_context_data, error_data, kError, NULL, 0,
- always_flags, arraysize(always_flags));
-
- RunParserSyncTest(sloppy_context_data, success_data, kError, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strict_context_data, success_data, kSuccess, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strong_context_data, success_data, kSuccess, NULL, 0,
- always_flags, arraysize(always_flags));
-}
-
-
-TEST(StrongConstructorSuper) {
- const char* sloppy_context_data[][2] = {{"", ""}, {NULL}};
- const char* strict_context_data[][2] = {{"'use strict';", ""}, {NULL}};
- const char* strong_context_data[][2] = {{"'use strong';", ""}, {NULL}};
-
- const char* error_data[] = {
+ const char* data[] = {
"class C extends Object { constructor() {} }",
- "class C extends Object { constructor() { super.a; } }",
- "class C extends Object { constructor() { super['a']; } }",
- "class C extends Object { constructor() { super.a = 0; } }",
- "class C extends Object { constructor() { (super.a); } }",
- // TODO(rossberg): arrow functions do not handle super yet.
- // "class C extends Object { constructor() { () => super.a; } }",
- "class C extends Object { constructor() { super(), 0; } }",
"class C extends Object { constructor() { (super()); } }",
- // "class C extends Object { constructor() { (() => super())(); } }",
+ "class C extends Object { constructor() { (() => super())(); } }",
"class C extends Object { constructor() { { super(); } } }",
"class C extends Object { constructor() { if (1) super(); } }",
- "class C extends Object { constructor() { label: super(); } }",
"class C extends Object { constructor() { super(), super(); } }",
"class C extends Object { constructor() { super(); super(); } }",
"class C extends Object { constructor() { super(); (super()); } }",
"class C extends Object { constructor() { super(); { super() } } }",
- "class C extends Object { constructor() { this.a = 0, super(); } }",
- "class C extends Object { constructor() { this.a = 0; super(); } }",
- "class C extends Object { constructor() { super(this.a = 0); } }",
- "class C extends Object { constructor() { super().a; } }",
- NULL};
-
- const char* success_data[] = {
- "class C extends Object { constructor() { super(); } }",
- "class C extends Object { constructor() { label: 66; super(); } }",
- "class C extends Object { constructor() { super(3); this.x = 0; } }",
- "class C extends Object { constructor() { 3; super(3); this.x = 0; } }",
NULL};
static const ParserFlag always_flags[] = {
kAllowStrongMode, kAllowHarmonyClasses, kAllowHarmonyObjectLiterals,
kAllowHarmonyArrowFunctions
};
- RunParserSyncTest(sloppy_context_data, error_data, kError, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strict_context_data, error_data, kSuccess, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strong_context_data, error_data, kError, NULL, 0,
- always_flags, arraysize(always_flags));
-
- RunParserSyncTest(sloppy_context_data, success_data, kError, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strict_context_data, success_data, kSuccess, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strong_context_data, success_data, kSuccess, NULL, 0,
- always_flags, arraysize(always_flags));
+ RunParserSyncTest(sloppy_context_data, data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
+ RunParserSyncTest(strict_context_data, data, kSuccess, NULL, 0, always_flags,
+ arraysize(always_flags));
+ RunParserSyncTest(strong_context_data, data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
}
@@ -5977,45 +5901,24 @@
const char* strict_context_data[][2] = {{"'use strict';", ""}, {NULL}};
const char* strong_context_data[][2] = {{"'use strong';", ""}, {NULL}};
- const char* error_data[] = {
+ const char* data[] = {
"class C extends Object { constructor() { super(); return {}; } }",
"class C extends Object { constructor() { super(); { return {}; } } }",
"class C extends Object { constructor() { super(); if (1) return {}; } }",
"class C extends Object { constructor() { return; super(); } }",
"class C extends Object { constructor() { { return; } super(); } }",
"class C extends Object { constructor() { if (0) return; super(); } }",
- "class C { constructor() { return; this.a = 0; } }",
- "class C { constructor() { { return; } this.a = 0; } }",
- "class C { constructor() { if (0) return; this.a = 0; } }",
- "class C { constructor() { this.a = 0; if (0) return; this.b = 0; } }",
- NULL};
-
- const char* success_data[] = {
- "class C extends Object { constructor() { super(); return; } }",
- "class C extends Object { constructor() { super(); { return } } }",
- "class C extends Object { constructor() { super(); if (1) return; } }",
- "class C { constructor() { this.a = 0; return; } }",
- "class C { constructor() { this.a = 0; { return; } } }",
- "class C { constructor() { this.a = 0; if (0) return; 65; } }",
- "class C extends Array { constructor() { super(); this.a = 9; return } }",
NULL};
static const ParserFlag always_flags[] = {
kAllowStrongMode, kAllowHarmonyClasses, kAllowHarmonyObjectLiterals
};
- RunParserSyncTest(sloppy_context_data, error_data, kError, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strict_context_data, error_data, kSuccess, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strong_context_data, error_data, kError, NULL, 0,
- always_flags, arraysize(always_flags));
-
- RunParserSyncTest(sloppy_context_data, success_data, kError, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strict_context_data, success_data, kSuccess, NULL, 0,
- always_flags, arraysize(always_flags));
- RunParserSyncTest(strong_context_data, success_data, kSuccess, NULL, 0,
- always_flags, arraysize(always_flags));
+ RunParserSyncTest(sloppy_context_data, data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
+ RunParserSyncTest(strict_context_data, data, kSuccess, NULL, 0, always_flags,
+ arraysize(always_flags));
+ RunParserSyncTest(strong_context_data, data, kError, NULL, 0, always_flags,
+ arraysize(always_flags));
}
« no previous file with comments | « src/preparser.cc ('k') | test/mjsunit/strong/classes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698