* @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)
| 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 | /** |
nothing calls this directly
no test coverage detected