Commit 278981d7 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[class] Test that fields are initialized before calling the base constructor

Bug: v8:5367
Change-Id: If10539597c07a497d0e9c89af9529ae90f92ddf3
Reviewed-on: https://chromium-review.googlesource.com/794470
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49711}
parent f55286c6
......@@ -649,3 +649,28 @@ x();
assertEquals(1, obj.x);
assertEquals(2, klass.x);
}
{
new class {
t = 1;
constructor(t = this.t) {
assertEquals(1, t);
}
}
new class extends class {} {
t = 1;
constructor(t = (super(), this.t)) {
assertEquals(1, t);
}
}
assertThrows(() => {
new class extends class {} {
t = 1;
constructor(t = this.t) {
super();
}
}
}, ReferenceError);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment