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

Function walk

test/app/lib/code-to-blocks.spec.js:22–39  ·  view source on GitHub ↗
(block)

Source from the content-addressed store, hash-verified

20 if (!blockContainer || !blockContainer.blocks) return foundBlocks
21
22 function walk (block) {
23 if (!block) return
24 if (block.type === targetType) {
25 foundBlocks.push(block)
26 }
27 // Follow the nextify statement chains (.next.block)
28 if (block.next && block.next.block) {
29 walk(block.next.block)
30 }
31 // Follow internal value inputs slots
32 if (block.inputs) {
33 for (const key in block.inputs) {
34 if (block.inputs[key].block) {
35 walk(block.inputs[key].block)
36 }
37 }
38 }
39 }
40
41 // Scan all root array entries generated by nextify
42 blockContainer.blocks.forEach(rootBlock => walk(rootBlock))

Callers 1

findBlocksByTypeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected