blob: 020dcbb6d8c546eb0c45e3d8735592cd0a938774 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright (C) 2021 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
description: >
ReferenceError when returning from a derived class constructor without calling
`super()` is thrown after the function body has been left, so an iterator
return handler can still call `super()`.
---*/
var iter = {
[Symbol.iterator]() {
return this;
},
next() {
return {done: false};
},
return() {
// Calls |super()|.
this.f();
return {done: true};
},
};
class C extends class {} {
constructor() {
iter.f = () => super();
for (var k of iter) {
return;
}
}
}
var o = new C();
assert.sameValue(typeof o, "object");
reportCompare(0, 0);
|