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

Method astVariableDeclaration

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

* @desc Parses the abstract syntax tree for *Variable Declaration* * @param {Object} varDecNode - An ast Node * @param {Array} retArr - return array string * @returns {Array} the append retArr

(varDecNode, retArr)

Source from the content-addressed store, hash-verified

320 * @returns {Array} the append retArr
321 */
322 astVariableDeclaration(varDecNode, retArr) {
323 retArr.push(`${varDecNode.kind} `);
324 const { declarations } = varDecNode;
325 for (let i = 0; i < declarations.length; i++) {
326 if (i > 0) {
327 retArr.push(',');
328 }
329 const declaration = declarations[i];
330 const info = this.getDeclaration(declaration.id);
331 if (!info.valueType) {
332 info.valueType = this.getType(declaration.init);
333 }
334 this.astGeneric(declaration, retArr);
335 }
336 if (!this.isState('in-for-loop-init')) {
337 retArr.push(';');
338 }
339 return retArr;
340 }
341
342 /**
343 * @desc Parses the abstract syntax tree for *If* Statement

Callers 1

astGenericMethod · 0.45

Calls 4

getTypeMethod · 0.80
astGenericMethod · 0.80
getDeclarationMethod · 0.45
isStateMethod · 0.45

Tested by

no test coverage detected