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

Method astArrayExpression

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

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

(arrNode, retArr)

Source from the content-addressed store, hash-verified

1498 * @returns {Array} the append retArr
1499 */
1500 astArrayExpression(arrNode, retArr) {
1501 const returnType = this.getType(arrNode);
1502
1503 const arrLen = arrNode.elements.length;
1504
1505 switch (returnType) {
1506 case 'Matrix(2)':
1507 case 'Matrix(3)':
1508 case 'Matrix(4)':
1509 retArr.push(`mat${arrLen}(`);
1510 break;
1511 default:
1512 retArr.push(`vec${arrLen}(`);
1513 }
1514 for (let i = 0; i < arrLen; ++i) {
1515 if (i > 0) {
1516 retArr.push(', ');
1517 }
1518 const subNode = arrNode.elements[i];
1519 this.astGeneric(subNode, retArr)
1520 }
1521 retArr.push(')');
1522
1523 return retArr;
1524 }
1525
1526 memberExpressionXYZ(x, y, z, retArr) {
1527 if (z) {

Callers 1

astMemberExpressionMethod · 0.95

Calls 2

getTypeMethod · 0.80
astGenericMethod · 0.80

Tested by

no test coverage detected