Skip to content
Snippets Groups Projects
Unverified Commit 9bddfaea authored by Leo Balter's avatar Leo Balter Committed by GitHub
Browse files

Merge pull request #1572 from rwaldron/super-property-reference

SuperProperty evaluation order
parents 6c2503a8 ecea13b0
No related branches found
No related tags found
No related merge requests found
// 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 must occur first.
---*/
class Derived extends Object {
constructor() {
super[super()];
throw new Test262Error();
}
}
assert.throws(ReferenceError, function() {
new Derived();
}, '`super[super()]` via `new Derived()` throws a ReferenceError');
// Copyright (C) 2014 the V8 project authors. All rights reserved. // Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es6id: 14.5 esid: sec-makesuperpropertyreference
description: > description: >
class super in constructor class super in constructor
---*/ ---*/
...@@ -18,4 +18,4 @@ class C extends B { ...@@ -18,4 +18,4 @@ class C extends B {
} }
new C; new C;
assert.sameValue(calls, 1, "The value of `calls` is `1`"); assert.sameValue(calls, 1, "The value of `calls` is `1`");
\ No newline at end of file
// Copyright (C) 2014 the V8 project authors. All rights reserved. // Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es6id: 14.5 esid: sec-makesuperpropertyreference
description: > description: >
class super in getter class super in getter
---*/ ---*/
...@@ -19,4 +19,4 @@ class C extends B { ...@@ -19,4 +19,4 @@ class C extends B {
return super.method(); 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`");
\ No newline at end of file
// Copyright (C) 2014 the V8 project authors. All rights reserved. // Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es6id: 14.5 esid: sec-makesuperpropertyreference
description: > description: >
class super in methods class super in methods
---*/ ---*/
...@@ -19,4 +19,4 @@ class C extends B { ...@@ -19,4 +19,4 @@ class C extends B {
return super.method(); 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`");
\ No newline at end of file
// Copyright (C) 2014 the V8 project authors. All rights reserved. // Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es6id: 14.5 esid: sec-makesuperpropertyreference
description: > description: >
class super in setter class super in setter
---*/ ---*/
...@@ -20,4 +20,4 @@ class C extends B { ...@@ -20,4 +20,4 @@ class C extends B {
assert.sameValue(super.method(), 1, "`super.method()` returns `1`"); 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`");
\ No newline at end of file
// Copyright (C) 2014 the V8 project authors. All rights reserved. // Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es6id: 14.5 esid: sec-makesuperpropertyreference
description: > description: >
class super in static getter class super in static getter
---*/ ---*/
...@@ -19,4 +19,4 @@ class C extends B { ...@@ -19,4 +19,4 @@ class C extends B {
return super.method(); 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`");
\ No newline at end of file
// Copyright (C) 2014 the V8 project authors. All rights reserved. // Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es6id: 14.5 esid: sec-makesuperpropertyreference
description: > description: >
class super in static methods class super in static methods
---*/ ---*/
...@@ -19,4 +19,4 @@ class C extends B { ...@@ -19,4 +19,4 @@ class C extends B {
return super.method(); return super.method();
} }
} }
assert.sameValue(C.method(), 1, "`C.method()` returns `1`"); assert.sameValue(C.method(), 1, "`C.method()` returns `1`");
\ No newline at end of file
// Copyright (C) 2014 the V8 project authors. All rights reserved. // Copyright (C) 2014 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es6id: 14.5 esid: sec-makesuperpropertyreference
description: > description: >
class super in static setter class super in static setter
---*/ ---*/
...@@ -20,4 +20,4 @@ class C extends B { ...@@ -20,4 +20,4 @@ class C extends B {
assert.sameValue(super.method(), 1, "`super.method()` returns `1`"); 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`");
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment