[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: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#49711}
This commit is contained in:
parent
f55286c6cd
commit
278981d73b
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user