C2LC-644: Update interpreter step logic to not stop on an End Loop block

Metadata

Source
C2LC-644
Type
Task
Priority
N/A
Status
Done
Resolution
N/A
Assignee
N/A
Reporter
Simon Bates
Created
2022-05-04T10:26:16.770-0400
Updated
2022-06-22T14:01:19.078-0400
Versions
N/A
Fixed Versions
  1. Coding Env 1.5
Component
  1. Coding Environment

Description

We will update the interpreter step logic as follows:

  • The program counter will never be on an End Loop block
  • The program counter can be on a Start Loop block
  • When we step on the final block in a loop, the program counter is set to either the corresponding Start Loop block (with the number of iterations decremented), if there are iterations left, or the block following the loop (if there is one), if there are no more iterations left
  • When an empty loop is being executed, we will highlight the Start Loop block rather than End Loop block
  • When an empty loop is paused, we will show the pause indicator on the Start Loop block

Comments

  • Simon Bates commented 2022-06-14T11:35:01.175-0400

    We also need to handle when the program is paused on the last block in a loop and that block is deleted. Currently when we delete a block with the programCounter on that block, the programCounter value is unchanged and the block following the one that is deleted will be executed next. In the case that the block being deleted is the last one in a loop, the programCounter would now be on the endLoop block.

  • Simon Bates commented 2022-06-14T13:56:57.867-0400

    I met with Sepideh and we will follow this logic:

    • When we delete the block that the program is paused on, we will move the programCounter to what would have happened after that block

    So, for the case where we are paused on the last block in a loop, and we delete that block, we will move the programCounter to what would have happened after that block: we will decrement the loop iterations and move execution back to the corresponding startLoop (if there are iterations left) or to where execution would have gone if there are no iterations left (the block following the loop, or back to the start of a parent loop).