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

Method astBlockStatement

src/backend/cpu/function-node.js:299–314  ·  view source on GitHub ↗

* @desc Parses the abstract syntax tree for *Block* statement * @param {Object} bNode - the AST object to parse * @param {Array} retArr - return array string * @returns {Array} the append retArr

(bNode, retArr)

Source from the content-addressed store, hash-verified

297 * @returns {Array} the append retArr
298 */
299 astBlockStatement(bNode, retArr) {
300 if (this.isState('loop-body')) {
301 this.pushState('block-body'); // this prevents recursive removal of braces
302 for (let i = 0; i < bNode.body.length; i++) {
303 this.astGeneric(bNode.body[i], retArr);
304 }
305 this.popState('block-body');
306 } else {
307 retArr.push('{\n');
308 for (let i = 0; i < bNode.body.length; i++) {
309 this.astGeneric(bNode.body[i], retArr);
310 }
311 retArr.push('}\n');
312 }
313 return retArr;
314 }
315
316 /**
317 * @desc Parses the abstract syntax tree for *Variable Declaration*

Callers

nothing calls this directly

Calls 4

astGenericMethod · 0.80
isStateMethod · 0.45
pushStateMethod · 0.45
popStateMethod · 0.45

Tested by

no test coverage detected