MCPcopy Index your code
hub / github.com/gpujs/gpu.js / astDoWhileStatement

Method astDoWhileStatement

src/backend/web-gl/function-node.js:730–744  ·  view source on GitHub ↗

* @desc Parses the abstract syntax tree for *do while* loop * @param {Object} doWhileNode - An ast Node * @param {Array} retArr - return array string * @returns {Array} the parsed webgl string

(doWhileNode, retArr)

Source from the content-addressed store, hash-verified

728 * @returns {Array} the parsed webgl string
729 */
730 astDoWhileStatement(doWhileNode, retArr) {
731 if (doWhileNode.type !== 'DoWhileStatement') {
732 throw this.astErrorOutput('Invalid while statement', doWhileNode);
733 }
734
735 const iVariableName = this.getInternalVariableName('safeI');
736 retArr.push(`for (int ${iVariableName}=0;${iVariableName}<LOOP_MAX;${iVariableName}++){\n`);
737 this.astGeneric(doWhileNode.body, retArr);
738 retArr.push('if (!');
739 this.astGeneric(doWhileNode.test, retArr);
740 retArr.push(') break;\n');
741 retArr.push('}\n');
742
743 return retArr;
744 }
745
746
747 /**

Callers

nothing calls this directly

Calls 3

astErrorOutputMethod · 0.80
astGenericMethod · 0.80

Tested by

no test coverage detected