MCPcopy Create free account
hub / github.com/codecombat/codecombat / ConvertWhileStatement

Method ConvertWhileStatement

app/lib/code-to-blocks.js:157–169  ·  view source on GitHub ↗
(n, ctx)

Source from the content-addressed store, hash-verified

155 }
156
157 static ConvertWhileStatement (n, ctx) {
158 const found = findOne(ctx.plan, x => fuzzyMatch(n, x[1]), 'Can\'t find the while statement')
159 const body = convert(n.body, { ...ctx, nospace: true, context: 'statement' })
160 const o = {
161 type: found[0].type,
162 inputs: {
163 BOOL: { block: convert(n.test, { ...ctx, context: 'value' }) },
164 },
165 }
166 if (body && body.length > 0) o.inputs.DO = { block: body[0] }
167
168 return o
169 }
170
171 static ConvertConditionalExpression (n, ctx) {
172 const found = findOne(ctx.plan, x => fuzzyMatch(n, x[1]), 'Can\'t find the ternary expression')

Callers

nothing calls this directly

Calls 3

findOneFunction · 0.85
fuzzyMatchFunction · 0.85
convertFunction · 0.85

Tested by

no test coverage detected