| 70 | } |
| 71 | |
| 72 | static ConvertVariableDeclaration (n, ctx) { |
| 73 | const result = [] |
| 74 | for (const d of n.declarations) { |
| 75 | ctx.scope[d.id.name] = { type: 'var' } |
| 76 | |
| 77 | if (!d.init) continue |
| 78 | |
| 79 | result.push({ |
| 80 | type: 'variables_set', |
| 81 | fields: { VAR: { id: d.id.name } }, |
| 82 | inputs: { |
| 83 | VALUE: { block: convert(d.init, { ...ctx, context: 'value' }) }, |
| 84 | }, |
| 85 | }) |
| 86 | } |
| 87 | return result.length > 0 ? nextify(result, { ...ctx, nospace: true })[0] : null |
| 88 | } |
| 89 | |
| 90 | static ConvertLiteral (n, ctx) { |
| 91 | switch (typeof (n.value)) { |