1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

Shell: Mark ForLoop as would_execute

This fixes #2825.
This commit is contained in:
AnotherTest 2020-07-17 01:11:23 +04:30 committed by Andreas Kling
parent c969b8390d
commit 8e364b9780
2 changed files with 6 additions and 3 deletions

View file

@ -1287,9 +1287,11 @@ RefPtr<Value> Sequence::run(RefPtr<Shell> shell)
// If we are to return a job, block on the left one then return the right one.
if (would_execute()) {
RefPtr<AST::Node> execute_node = create<AST::Execute>(m_left->position(), m_left);
auto left_job = execute_node->run(shell);
ASSERT(left_job->is_job());
shell->block_on_job(static_cast<JobValue*>(left_job.ptr())->job());
auto left_value = execute_node->run(shell);
// Some nodes are inherently empty, such as Comments and For loops without bodies,
// it is not an error for the value not to be a job.
if (left_value && left_value->is_job())
shell->block_on_job(static_cast<JobValue*>(left_value.ptr())->job());
if (m_right->would_execute())
return m_right->run(shell);