| 12345678910111213141516171819202122 |
- /** 语句:for 循环(解析在此,执行在 sequence-runner) */
- const types = ['for']
- function parse(action, parseContext) {
- const { resolveValue, parseActions } = parseContext
- const variableContext = parseContext.variableContext || {}
- const parsed = {
- type: 'for',
- variable: action.variable,
- indexVariable: action.indexVariable,
- times: action.times,
- items: action.items != null ? resolveValue(action.items, variableContext) : null,
- body: action.body ? parseActions(action.body) : [],
- }
- return Object.assign({}, action, parsed)
- }
- async function execute() {
- return { success: true }
- }
- module.exports = { types, parse, execute }
|