MCPcopy Create free account
hub / github.com/compilets/compilets / parseCallExpression

Method parseCallExpression

src/parser.ts:653–675  ·  view source on GitHub ↗
(node: ts.CallExpression)

Source from the content-addressed store, hash-verified

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 {

Callers 1

parseExpressionMethod · 0.95

Calls 4

parseExpressionMethod · 0.95
parseArgumentsMethod · 0.95
parseNodeTypeMethod · 0.80
parseSignatureTypeMethod · 0.80

Tested by

no test coverage detected