* @desc Parses the abstract syntax tree for *Member* Expression * @param {Object} mNode - An ast Node * @param {Array} retArr - return array string * @returns {Array} the append retArr
(mNode, retArr)
| 1039 | * @returns {Array} the append retArr |
| 1040 | */ |
| 1041 | astMemberExpression(mNode, retArr) { |
| 1042 | const { |
| 1043 | property, |
| 1044 | name, |
| 1045 | signature, |
| 1046 | origin, |
| 1047 | type, |
| 1048 | xProperty, |
| 1049 | yProperty, |
| 1050 | zProperty |
| 1051 | } = this.getMemberExpressionDetails(mNode); |
| 1052 | switch (signature) { |
| 1053 | case 'value.thread.value': |
| 1054 | case 'this.thread.value': |
| 1055 | if (name !== 'x' && name !== 'y' && name !== 'z') { |
| 1056 | throw this.astErrorOutput('Unexpected expression, expected `this.thread.x`, `this.thread.y`, or `this.thread.z`', mNode); |
| 1057 | } |
| 1058 | retArr.push(`threadId.${name}`); |
| 1059 | return retArr; |
| 1060 | case 'this.output.value': |
| 1061 | if (this.dynamicOutput) { |
| 1062 | switch (name) { |
| 1063 | case 'x': |
| 1064 | if (this.isState('casting-to-float')) { |
| 1065 | retArr.push('float(uOutputDim.x)'); |
| 1066 | } else { |
| 1067 | retArr.push('uOutputDim.x'); |
| 1068 | } |
| 1069 | break; |
| 1070 | case 'y': |
| 1071 | if (this.isState('casting-to-float')) { |
| 1072 | retArr.push('float(uOutputDim.y)'); |
| 1073 | } else { |
| 1074 | retArr.push('uOutputDim.y'); |
| 1075 | } |
| 1076 | break; |
| 1077 | case 'z': |
| 1078 | if (this.isState('casting-to-float')) { |
| 1079 | retArr.push('float(uOutputDim.z)'); |
| 1080 | } else { |
| 1081 | retArr.push('uOutputDim.z'); |
| 1082 | } |
| 1083 | break; |
| 1084 | default: |
| 1085 | throw this.astErrorOutput('Unexpected expression', mNode); |
| 1086 | } |
| 1087 | } else { |
| 1088 | switch (name) { |
| 1089 | case 'x': |
| 1090 | if (this.isState('casting-to-integer')) { |
| 1091 | retArr.push(this.output[0]); |
| 1092 | } else { |
| 1093 | retArr.push(this.output[0], '.0'); |
| 1094 | } |
| 1095 | break; |
| 1096 | case 'y': |
| 1097 | if (this.isState('casting-to-integer')) { |
| 1098 | retArr.push(this.output[1]); |
nothing calls this directly
no test coverage detected