mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 23:25:20 +00:00
LibJS/Bytecode: Leave for in and for of with right completion value
14 new passes on test262. :^)
This commit is contained in:
@@ -2705,9 +2705,15 @@ static Bytecode::CodeGenerationErrorOr<void> for_in_of_body_evaluation(Bytecode:
|
||||
// 1. Assert: iterationKind is iterate.
|
||||
// 2. Return ? IteratorClose(iteratorRecord, status).
|
||||
|
||||
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
|
||||
|
||||
// l. Let result be the result of evaluating stmt.
|
||||
TRY(body.generate_bytecode(generator));
|
||||
|
||||
auto result_register = generator.allocate_register();
|
||||
if (!generator.is_current_block_terminated())
|
||||
generator.emit<Bytecode::Op::Store>(result_register);
|
||||
|
||||
// m. Set the running execution context's LexicalEnvironment to oldEnv.
|
||||
if (has_lexical_binding)
|
||||
generator.end_variable_scope();
|
||||
@@ -2730,6 +2736,7 @@ static Bytecode::CodeGenerationErrorOr<void> for_in_of_body_evaluation(Bytecode:
|
||||
generator.emit<Bytecode::Op::Jump>().set_targets(Bytecode::Label { loop_update }, {});
|
||||
|
||||
generator.switch_to_basic_block(loop_end);
|
||||
generator.emit<Bytecode::Op::Load>(result_register);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user