LibJS: Make SetCompletionType bytecode instruction actually set type

This recovers 38 tests in test262 that regressed in a0bb31f7a0.
This commit is contained in:
Andreas Kling 2025-04-05 14:06:33 +02:00 committed by Jelle Raaijmakers
parent 026bc91d6c
commit fe1962d7fa
Notes: github-actions[bot] 2025-04-05 13:01:03 +00:00
2 changed files with 44 additions and 1 deletions

View file

@ -3847,7 +3847,7 @@ void SetCompletionType::execute_impl(Bytecode::Interpreter& interpreter) const
{
auto& completion_cell = static_cast<CompletionCell&>(interpreter.get(m_completion).as_cell());
auto completion = completion_cell.completion();
completion_cell.set_completion(Completion { completion.type(), completion.value() });
completion_cell.set_completion(Completion { m_type, completion.value() });
}
ByteString SetCompletionType::to_byte_string_impl(Bytecode::Executable const& executable) const

View file

@ -0,0 +1,43 @@
test("test", () => {
var obj = {
[Symbol.iterator]() {
return {
next() {
return { value: 1, done: false };
},
};
},
};
async function* asyncg() {
yield* obj;
}
let fail = false;
let done = false;
function FAIL() {
fail = true;
}
function DONE() {
done = true;
}
var iter = asyncg();
iter.next()
.then(function (result) {
iter.return()
.then(function (result) {
expect(result.done).toBeTrue();
expect(result.value).toBeUndefined();
})
.catch(FAIL);
})
.catch(FAIL)
.then(DONE);
runQueuedPromiseJobs();
expect(fail).toBe(false);
expect(done).toBe(true);
});