for-parser.js 569 B

123456789101112131415161718192021
  1. /** 语句:for 循环(解析在此,执行在 sequence-runner) */
  2. const types = ['for']
  3. function parse(action, parseContext) {
  4. const { parseActions } = parseContext
  5. const parsed = {
  6. type: 'for',
  7. variable: action.variable,
  8. indexVariable: action.indexVariable,
  9. times: action.times,
  10. array: action.array != null ? action.array : null,
  11. body: action.body ? parseActions(action.body) : [],
  12. }
  13. return Object.assign({}, action, parsed)
  14. }
  15. async function execute() {
  16. return { success: true }
  17. }
  18. module.exports = { types, parse, execute }