cortictechnology / cep

CEP is a software platform designed for users that want to learn or rapidly prototype using standard A.I. components.
MIT License
166 stars 21 forks source link

Wrapping up dispatch execution feature #8

Closed michaelhwn closed 2 years ago

michaelhwn commented 2 years ago

In this merge, two issues are being fixed for the dispatch execution feature:

  1. When users define their own functions in the workspace, these functions cannot be used in the dispatch block. This was because the function definition only exists in the main program, so the program executed in the dispatch block does not know how to call such functions. This is fixed by first parsing the full definition of these user-defined functions, then passing in the full definition of these functions into the dispatch block as part of the program.
  2. When the programs in the dispatch block are being executed, there were no block highlightings on those programs. This is fixed by using Blockly.JavaScript.STATEMENT_PREFIX and Blockly.JavaScript.STATEMENT_SUFFIX to add a highlight and dehighlight statement before and after a block is executed. This way, both programs within the main block and programs within the dispatch can be highlighted during execution.