* Returns the effective arguments for an expression that works like a function invocation.
(node)
| 75804 | * Returns the effective arguments for an expression that works like a function invocation. |
| 75805 | */ |
| 75806 | function getEffectiveCallArguments(node) { |
| 75807 | if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { |
| 75808 | var template = node.template; |
| 75809 | var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; |
| 75810 | if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { |
| 75811 | ts.forEach(template.templateSpans, function (span) { |
| 75812 | args_3.push(span.expression); |
| 75813 | }); |
| 75814 | } |
| 75815 | return args_3; |
| 75816 | } |
| 75817 | if (node.kind === 165 /* SyntaxKind.Decorator */) { |
| 75818 | return getEffectiveDecoratorArguments(node); |
| 75819 | } |
| 75820 | if (ts.isJsxOpeningLikeElement(node)) { |
| 75821 | return node.attributes.properties.length > 0 || (ts.isJsxOpeningElement(node) && node.parent.children.length > 0) ? [node.attributes] : ts.emptyArray; |
| 75822 | } |
| 75823 | var args = node.arguments || ts.emptyArray; |
| 75824 | var spreadIndex = getSpreadArgumentIndex(args); |
| 75825 | if (spreadIndex >= 0) { |
| 75826 | // Create synthetic arguments from spreads of tuple types. |
| 75827 | var effectiveArgs_1 = args.slice(0, spreadIndex); |
| 75828 | var _loop_24 = function (i) { |
| 75829 | var arg = args[i]; |
| 75830 | // We can call checkExpressionCached because spread expressions never have a contextual type. |
| 75831 | var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); |
| 75832 | if (spreadType && isTupleType(spreadType)) { |
| 75833 | ts.forEach(getTypeArguments(spreadType), function (t, i) { |
| 75834 | var _a; |
| 75835 | var flags = spreadType.target.elementFlags[i]; |
| 75836 | var syntheticArg = createSyntheticExpression(arg, flags & 4 /* ElementFlags.Rest */ ? createArrayType(t) : t, !!(flags & 12 /* ElementFlags.Variable */), (_a = spreadType.target.labeledElementDeclarations) === null || _a === void 0 ? void 0 : _a[i]); |
| 75837 | effectiveArgs_1.push(syntheticArg); |
| 75838 | }); |
| 75839 | } |
| 75840 | else { |
| 75841 | effectiveArgs_1.push(arg); |
| 75842 | } |
| 75843 | }; |
| 75844 | for (var i = spreadIndex; i < args.length; i++) { |
| 75845 | _loop_24(i); |
| 75846 | } |
| 75847 | return effectiveArgs_1; |
| 75848 | } |
| 75849 | return args; |
| 75850 | } |
| 75851 | /** |
| 75852 | * Returns the synthetic argument list for a decorator invocation. |
| 75853 | */ |
no test coverage detected
searching dependent graphs…