mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
LibJS: Make SetCompletionType bytecode instruction actually set type
This recovers 38 tests in test262 that regressed in a0bb31f7a0
.
This commit is contained in:
parent
026bc91d6c
commit
fe1962d7fa
Notes:
github-actions[bot]
2025-04-05 13:01:03 +00:00
Author: https://github.com/awesomekling
Commit: fe1962d7fa
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4236
Reviewed-by: https://github.com/gmta ✅
2 changed files with 44 additions and 1 deletions
|
@ -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_cell = static_cast<CompletionCell&>(interpreter.get(m_completion).as_cell());
|
||||||
auto completion = completion_cell.completion();
|
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
|
ByteString SetCompletionType::to_byte_string_impl(Bytecode::Executable const& executable) const
|
||||||
|
|
|
@ -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);
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue