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

Method ConvertIdentifier

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

Source from the content-addressed store, hash-verified

526 }
527
528 static ConvertIdentifier (n, ctx) {
529 let out
530 if (n.name in ctx.scope && ctx.scope[n.name].type === 'var') {
531 out = {
532 type: 'variables_get',
533 fields: { VAR: { id: n.name } },
534 }
535 } else {
536 const found = findOne(ctx.plan, x => fuzzyMatch(n, x[1]), `Unknown variable ${n.name}`)
537 out = {
538 type: found[0].type,
539 }
540 }
541 if (ctx.context === 'statement') {
542 return {
543 type: 'expression_statement',
544 inputs: {
545 EXPRESSION: { block: out },
546 },
547 }
548 }
549 return out
550 }
551
552 static ConvertUnaryExpression (n, ctx) {
553 return null

Callers

nothing calls this directly

Calls 2

findOneFunction · 0.85
fuzzyMatchFunction · 0.85

Tested by

no test coverage detected