mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 14:07:42 +00:00
LibJS/Bytecode: Leave for in
and for of
with right completion value
14 new passes on test262. :^)
This commit is contained in:
parent
7430dee5cf
commit
b14032bbfa
1 changed files with 7 additions and 0 deletions
|
@ -2705,9 +2705,15 @@ static Bytecode::CodeGenerationErrorOr<void> for_in_of_body_evaluation(Bytecode:
|
||||||
// 1. Assert: iterationKind is iterate.
|
// 1. Assert: iterationKind is iterate.
|
||||||
// 2. Return ? IteratorClose(iteratorRecord, status).
|
// 2. Return ? IteratorClose(iteratorRecord, status).
|
||||||
|
|
||||||
|
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
|
||||||
|
|
||||||
// l. Let result be the result of evaluating stmt.
|
// l. Let result be the result of evaluating stmt.
|
||||||
TRY(body.generate_bytecode(generator));
|
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.
|
// m. Set the running execution context's LexicalEnvironment to oldEnv.
|
||||||
if (has_lexical_binding)
|
if (has_lexical_binding)
|
||||||
generator.end_variable_scope();
|
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.emit<Bytecode::Op::Jump>().set_targets(Bytecode::Label { loop_update }, {});
|
||||||
|
|
||||||
generator.switch_to_basic_block(loop_end);
|
generator.switch_to_basic_block(loop_end);
|
||||||
|
generator.emit<Bytecode::Op::Load>(result_register);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue