SuperProperty evaluation order

super[super()] should evaluate and resolve super() first
This commit is contained in:
Rick Waldron 2018-05-24 15:10:13 -04:00
parent a8f7012587
commit 85a4484c52
8 changed files with 30 additions and 14 deletions

View File

@ -0,0 +1,16 @@
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-makesuperpropertyreference
description: >
SuperProperty evaluation order: super() thisBinding initialization occurs first.
---*/
class Derived extends Object {
constructor() {
super[super()];
}
}
var derived = new Derived();
assert.sameValue(derived instanceof Derived, true);
assert.sameValue(derived instanceof Object, true);

View File

@ -1,7 +1,7 @@
// Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 14.5
esid: sec-makesuperpropertyreference
description: >
class super in constructor
---*/
@ -18,4 +18,4 @@ class C extends B {
}
new C;
assert.sameValue(calls, 1, "The value of `calls` is `1`");
assert.sameValue(calls, 1, "The value of `calls` is `1`");

View File

@ -1,7 +1,7 @@
// Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 14.5
esid: sec-makesuperpropertyreference
description: >
class super in getter
---*/
@ -19,4 +19,4 @@ class C extends B {
return super.method();
}
}
assert.sameValue(new C().y, 1, "The value of `new C().y` is `1`");
assert.sameValue(new C().y, 1, "The value of `new C().y` is `1`");

View File

@ -1,7 +1,7 @@
// Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 14.5
esid: sec-makesuperpropertyreference
description: >
class super in methods
---*/
@ -19,4 +19,4 @@ class C extends B {
return super.method();
}
}
assert.sameValue(new C().method(), 1, "`new C().method()` returns `1`");
assert.sameValue(new C().method(), 1, "`new C().method()` returns `1`");

View File

@ -1,7 +1,7 @@
// Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 14.5
esid: sec-makesuperpropertyreference
description: >
class super in setter
---*/
@ -20,4 +20,4 @@ class C extends B {
assert.sameValue(super.method(), 1, "`super.method()` returns `1`");
}
}
assert.sameValue(new C().y = 3, 3, "`new C().y = 3` is `3`");
assert.sameValue(new C().y = 3, 3, "`new C().y = 3` is `3`");

View File

@ -1,7 +1,7 @@
// Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 14.5
esid: sec-makesuperpropertyreference
description: >
class super in static getter
---*/
@ -19,4 +19,4 @@ class C extends B {
return super.method();
}
}
assert.sameValue(C.x, 1, "The value of `C.x` is `1`");
assert.sameValue(C.x, 1, "The value of `C.x` is `1`");

View File

@ -1,7 +1,7 @@
// Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 14.5
esid: sec-makesuperpropertyreference
description: >
class super in static methods
---*/
@ -19,4 +19,4 @@ class C extends B {
return super.method();
}
}
assert.sameValue(C.method(), 1, "`C.method()` returns `1`");
assert.sameValue(C.method(), 1, "`C.method()` returns `1`");

View File

@ -1,7 +1,7 @@
// Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 14.5
esid: sec-makesuperpropertyreference
description: >
class super in static setter
---*/
@ -20,4 +20,4 @@ class C extends B {
assert.sameValue(super.method(), 1, "`super.method()` returns `1`");
}
}
assert.sameValue(C.x = 3, 3, "`C.x = 3` is `3`");
assert.sameValue(C.x = 3, 3, "`C.x = 3` is `3`");