(node: ts.CallExpression)
| 651 | } |
| 652 | |
| 653 | parseCallExpression(node: ts.CallExpression): syntax.Expression { |
| 654 | const {expression, questionDotToken} = node; |
| 655 | if (questionDotToken) |
| 656 | throw new UnimplementedError(node, 'The ?. operator is not supported'); |
| 657 | const type = this.typer.parseNodeType(node); |
| 658 | const callee = this.parseExpression(expression); |
| 659 | const args = this.parseArguments(node, node['arguments']); |
| 660 | // Get the type of the resolved function signature, which is used for |
| 661 | // inferring the type arguments when calling generic functions. |
| 662 | const signature = this.typer.typeChecker.getResolvedSignature(node); |
| 663 | if (!signature) |
| 664 | throw new UnsupportedError(node, 'Can not get resolved signature'); |
| 665 | const resolvedFunctionType = this.typer.parseSignatureType(signature, node); |
| 666 | // Update function type with resolved signature's name and templates. |
| 667 | if (callee.type.category == 'functor') |
| 668 | callee.type.name = resolvedFunctionType.name; |
| 669 | callee.type.templateArguments = resolvedFunctionType.templateArguments; |
| 670 | // Method is handled differently from the normal function. |
| 671 | if (ts.isPropertyAccessExpression(expression) && callee.type.category == 'method') |
| 672 | return new syntax.MethodCallExpression(type, callee as syntax.PropertyAccessExpression, args); |
| 673 | else |
| 674 | return new syntax.CallExpression(type, callee, args); |
| 675 | } |
| 676 | |
| 677 | parseArguments(node: ts.CallLikeExpression, |
| 678 | args?: ts.NodeArray<ts.Expression>): syntax.CallArguments { |
no test coverage detected