* * @param ast * @return {IFunctionNodeMemberExpressionDetails}
(ast)
| 1205 | * @return {IFunctionNodeMemberExpressionDetails} |
| 1206 | */ |
| 1207 | getMemberExpressionDetails(ast) { |
| 1208 | if (ast.type !== 'MemberExpression') { |
| 1209 | throw this.astErrorOutput(`Expression ${ ast.type } not a MemberExpression`, ast); |
| 1210 | } |
| 1211 | let name = null; |
| 1212 | let type = null; |
| 1213 | const variableSignature = this.getVariableSignature(ast); |
| 1214 | switch (variableSignature) { |
| 1215 | case 'value': |
| 1216 | return null; |
| 1217 | case 'value.thread.value': |
| 1218 | case 'this.thread.value': |
| 1219 | case 'this.output.value': |
| 1220 | return { |
| 1221 | signature: variableSignature, |
| 1222 | type: 'Integer', |
| 1223 | name: ast.property.name |
| 1224 | }; |
| 1225 | case 'value[]': |
| 1226 | if (typeof ast.object.name !== 'string') { |
| 1227 | throw this.astErrorOutput('Unexpected expression', ast); |
| 1228 | } |
| 1229 | name = ast.object.name; |
| 1230 | return { |
| 1231 | name, |
| 1232 | origin: 'user', |
| 1233 | signature: variableSignature, |
| 1234 | type: this.getVariableType(ast.object), |
| 1235 | xProperty: ast.property |
| 1236 | }; |
| 1237 | case 'value[][]': |
| 1238 | if (typeof ast.object.object.name !== 'string') { |
| 1239 | throw this.astErrorOutput('Unexpected expression', ast); |
| 1240 | } |
| 1241 | name = ast.object.object.name; |
| 1242 | return { |
| 1243 | name, |
| 1244 | origin: 'user', |
| 1245 | signature: variableSignature, |
| 1246 | type: this.getVariableType(ast.object.object), |
| 1247 | yProperty: ast.object.property, |
| 1248 | xProperty: ast.property, |
| 1249 | }; |
| 1250 | case 'value[][][]': |
| 1251 | if (typeof ast.object.object.object.name !== 'string') { |
| 1252 | throw this.astErrorOutput('Unexpected expression', ast); |
| 1253 | } |
| 1254 | name = ast.object.object.object.name; |
| 1255 | return { |
| 1256 | name, |
| 1257 | origin: 'user', |
| 1258 | signature: variableSignature, |
| 1259 | type: this.getVariableType(ast.object.object.object), |
| 1260 | zProperty: ast.object.object.property, |
| 1261 | yProperty: ast.object.property, |
| 1262 | xProperty: ast.property, |
| 1263 | }; |
| 1264 | case 'value[][][][]': |
no test coverage detected