MCPcopy Index your code
hub / github.com/nodejs/node / visitNonOptionalCallExpression

Function visitNonOptionalCallExpression

test/fixtures/snapshot/typescript.js:97499–97514  ·  view source on GitHub ↗
(node, captureThisArg)

Source from the content-addressed store, hash-verified

97497 return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression;
97498 }
97499 function visitNonOptionalCallExpression(node, captureThisArg) {
97500 if (ts.isOptionalChain(node)) {
97501 // If `node` is an optional chain, then it is the outermost chain of an optional expression.
97502 return visitOptionalExpression(node, captureThisArg, /*isDelete*/ false);
97503 }
97504 if (ts.isParenthesizedExpression(node.expression) && ts.isOptionalChain(ts.skipParentheses(node.expression))) {
97505 // capture thisArg for calls of parenthesized optional chains like `(foo?.bar)()`
97506 var expression = visitNonOptionalParenthesizedExpression(node.expression, /*captureThisArg*/ true, /*isDelete*/ false);
97507 var args = ts.visitNodes(node.arguments, visitor, ts.isExpression);
97508 if (ts.isSyntheticReference(expression)) {
97509 return ts.setTextRange(factory.createFunctionCallCall(expression.expression, expression.thisArg, args), node);
97510 }
97511 return factory.updateCallExpression(node, expression, /*typeArguments*/ undefined, args);
97512 }
97513 return ts.visitEachChild(node, visitor, context);
97514 }
97515 function visitNonOptionalExpression(node, captureThisArg, isDelete) {
97516 switch (node.kind) {
97517 case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete);

Callers 2

visitorFunction · 0.85

Tested by

no test coverage detected