* @desc Return the type of parameter sent to subKernel/Kernel. * @param {Object} ast - Identifier * @returns {String} Type of the parameter
(ast)
| 273 | * @returns {String} Type of the parameter |
| 274 | */ |
| 275 | getVariableType(ast) { |
| 276 | if (ast.type !== 'Identifier') { |
| 277 | throw new Error(`ast of ${ast.type} not "Identifier"`); |
| 278 | } |
| 279 | let type = null; |
| 280 | const argumentIndex = this.argumentNames.indexOf(ast.name); |
| 281 | if (argumentIndex === -1) { |
| 282 | const declaration = this.getDeclaration(ast); |
| 283 | if (declaration) { |
| 284 | return declaration.valueType; |
| 285 | } |
| 286 | } else { |
| 287 | const argumentType = this.argumentTypes[argumentIndex]; |
| 288 | if (argumentType) { |
| 289 | type = argumentType; |
| 290 | } |
| 291 | } |
| 292 | if (!type && this.strictTypingChecking) { |
| 293 | throw new Error(`Declaration of ${name} not found`); |
| 294 | } |
| 295 | return type; |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * Generally used to lookup the value type returned from a member expressions |
no test coverage detected