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

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

Issue 1135243004: [es6] Support super.property in eval and arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: All ports done Created 5 years, 7 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
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index f0abbc958f9a241f2270bc85864db9561817c34b..872bdf5a26e09fbad18a7e6760af3caa68dd0ccd 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -961,56 +961,54 @@ TEST(ScopeUsesArgumentsSuperThis) {
SUPER_PROPERTY = 1 << 1,
THIS = 1 << 2,
INNER_ARGUMENTS = 1 << 3,
- INNER_SUPER_PROPERTY = 1 << 4,
};
static const struct {
const char* body;
int expected;
} source_data[] = {
- {"", NONE},
- {"return this", THIS},
- {"return arguments", ARGUMENTS},
- {"return super.x", SUPER_PROPERTY},
- {"return arguments[0]", ARGUMENTS},
- {"return this + arguments[0]", ARGUMENTS | THIS},
- {"return this + arguments[0] + super.x",
- ARGUMENTS | SUPER_PROPERTY | THIS},
- {"return x => this + x", THIS},
- {"return x => super.f() + x", INNER_SUPER_PROPERTY},
- {"this.foo = 42;", THIS},
- {"this.foo();", THIS},
- {"if (foo()) { this.f() }", THIS},
- {"if (foo()) { super.f() }", SUPER_PROPERTY},
- {"if (arguments.length) { this.f() }", ARGUMENTS | THIS},
- {"while (true) { this.f() }", THIS},
- {"while (true) { super.f() }", SUPER_PROPERTY},
- {"if (true) { while (true) this.foo(arguments) }", ARGUMENTS | THIS},
- // Multiple nesting levels must work as well.
- {"while (true) { while (true) { while (true) return this } }", THIS},
- {"while (true) { while (true) { while (true) return super.f() } }",
- SUPER_PROPERTY},
- {"if (1) { return () => { while (true) new this() } }", THIS},
- {"return function (x) { return this + x }", NONE},
- {"return { m(x) { return super.m() + x } }", NONE},
- {"var x = function () { this.foo = 42 };", NONE},
- {"var x = { m() { super.foo = 42 } };", NONE},
- {"if (1) { return function () { while (true) new this() } }", NONE},
- {"if (1) { return { m() { while (true) super.m() } } }", NONE},
- {"return function (x) { return () => this }", NONE},
- {"return { m(x) { return () => super.m() } }", NONE},
- // Flags must be correctly set when using block scoping.
- {"\"use strict\"; while (true) { let x; this, arguments; }",
- INNER_ARGUMENTS | THIS},
- {"\"use strict\"; while (true) { let x; this, super.f(), arguments; }",
- INNER_ARGUMENTS | INNER_SUPER_PROPERTY | THIS},
- {"\"use strict\"; if (foo()) { let x; this.f() }", THIS},
- {"\"use strict\"; if (foo()) { let x; super.f() }",
- INNER_SUPER_PROPERTY},
- {"\"use strict\"; if (1) {"
- " let x; return { m() { return this + super.m() + arguments } }"
- "}",
- NONE},
+ {"", NONE},
+ {"return this", THIS},
+ {"return arguments", ARGUMENTS},
+ {"return super.x", SUPER_PROPERTY},
+ {"return arguments[0]", ARGUMENTS},
+ {"return this + arguments[0]", ARGUMENTS | THIS},
+ {"return this + arguments[0] + super.x",
+ ARGUMENTS | SUPER_PROPERTY | THIS},
+ {"return x => this + x", THIS},
+ {"return x => super.f() + x", SUPER_PROPERTY},
+ {"this.foo = 42;", THIS},
+ {"this.foo();", THIS},
+ {"if (foo()) { this.f() }", THIS},
+ {"if (foo()) { super.f() }", SUPER_PROPERTY},
+ {"if (arguments.length) { this.f() }", ARGUMENTS | THIS},
+ {"while (true) { this.f() }", THIS},
+ {"while (true) { super.f() }", SUPER_PROPERTY},
+ {"if (true) { while (true) this.foo(arguments) }", ARGUMENTS | THIS},
+ // Multiple nesting levels must work as well.
+ {"while (true) { while (true) { while (true) return this } }", THIS},
+ {"while (true) { while (true) { while (true) return super.f() } }",
+ SUPER_PROPERTY},
+ {"if (1) { return () => { while (true) new this() } }", THIS},
+ {"return function (x) { return this + x }", NONE},
+ {"return { m(x) { return super.m() + x } }", NONE},
+ {"var x = function () { this.foo = 42 };", NONE},
+ {"var x = { m() { super.foo = 42 } };", NONE},
+ {"if (1) { return function () { while (true) new this() } }", NONE},
+ {"if (1) { return { m() { while (true) super.m() } } }", NONE},
+ {"return function (x) { return () => this }", NONE},
+ {"return { m(x) { return () => super.m() } }", NONE},
+ // Flags must be correctly set when using block scoping.
+ {"\"use strict\"; while (true) { let x; this, arguments; }",
+ INNER_ARGUMENTS | THIS},
+ {"\"use strict\"; while (true) { let x; this, super.f(), arguments; }",
+ INNER_ARGUMENTS | SUPER_PROPERTY | THIS},
+ {"\"use strict\"; if (foo()) { let x; this.f() }", THIS},
+ {"\"use strict\"; if (foo()) { let x; super.f() }", SUPER_PROPERTY},
+ {"\"use strict\"; if (1) {"
+ " let x; return { m() { return this + super.m() + arguments } }"
+ "}",
+ NONE},
};
i::Isolate* isolate = CcTest::i_isolate();
@@ -1027,7 +1025,6 @@ TEST(ScopeUsesArgumentsSuperThis) {
for (unsigned i = 0; i < arraysize(source_data); ++i) {
// Super property is only allowed in constructor and method.
if (((source_data[i].expected & SUPER_PROPERTY) ||
- (source_data[i].expected & INNER_SUPER_PROPERTY) ||
(source_data[i].expected == NONE)) && j != 2) {
continue;
}
@@ -1075,8 +1072,6 @@ TEST(ScopeUsesArgumentsSuperThis) {
}
CHECK_EQ((source_data[i].expected & INNER_ARGUMENTS) != 0,
scope->inner_uses_arguments());
- CHECK_EQ((source_data[i].expected & INNER_SUPER_PROPERTY) != 0,
- scope->inner_uses_super_property());
}
}
}

Powered by Google App Engine
This is Rietveld 408576698