MCPcopy Index your code
hub / github.com/processing/p5.js / initializeLoopVariable

Method initializeLoopVariable

src/strands/strands_for.js:307–325  ·  view source on GitHub ↗
(cfg, branchBlock)

Source from the content-addressed store, hash-verified

305 }
306
307 initializeLoopVariable(cfg, branchBlock) {
308 CFG.pushBlock(cfg, branchBlock);
309 let initialVar = this.initialCb();
310
311 // Convert to StrandsNode if it's not already one
312 if (!(initialVar?.isStrandsNode)) {
313 const { id, dimension } = primitiveConstructorNode(this.strandsContext, { baseType: BaseType.FLOAT, dimension: 1 }, initialVar);
314 initialVar = createStrandsNode(id, dimension, this.strandsContext);
315 }
316
317 // Create phi node for the loop variable in the BRANCH block
318 const phiNode = createPhiNode(this.strandsContext, [
319 { value: initialVar, blockId: branchBlock },
320 { value: initialVar, blockId: branchBlock } // Placeholder, will be updated later
321 ], 'loopVar');
322 CFG.popBlock(cfg);
323
324 return { initialVar, phiNode };
325 }
326
327 createLogicalNotNode(conditionNode) {
328 const notOperationNode = DAG.createNodeData({

Callers 1

buildMethod · 0.95

Calls 3

primitiveConstructorNodeFunction · 0.90
createStrandsNodeFunction · 0.90
createPhiNodeFunction · 0.90

Tested by

no test coverage detected