blob: 8b13b71140fc2aad2d1535939601876ec44fb4d9 [file] [log] [blame]
function shouldBe(actual, expected) {
if (actual !== expected)
throw new Error('bad value: ' + actual);
}
var GeneratorFunction = (function *() { }).constructor;
class DerivedGeneratorFunction extends GeneratorFunction {
constructor()
{
super("yield 42");
}
hello()
{
return 50;
}
}
let DerivedGenerator = new DerivedGeneratorFunction();
shouldBe(DerivedGenerator.__proto__, DerivedGeneratorFunction.prototype);
shouldBe(DerivedGenerator.hello(), 50);
let gen = DerivedGenerator();
shouldBe(gen.next().value, 42);