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

Method ConvertVariableDeclaration

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

Source from the content-addressed store, hash-verified

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)) {

Callers

nothing calls this directly

Calls 2

convertFunction · 0.85
nextifyFunction · 0.85

Tested by

no test coverage detected