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

Function transformNullishCoalescingExpression

test/fixtures/snapshot/typescript.js:97579–97589  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

97577 return factory.createBinaryExpression(factory.createBinaryExpression(left, factory.createToken(invert ? 36 /* SyntaxKind.EqualsEqualsEqualsToken */ : 37 /* SyntaxKind.ExclamationEqualsEqualsToken */), factory.createNull()), factory.createToken(invert ? 56 /* SyntaxKind.BarBarToken */ : 55 /* SyntaxKind.AmpersandAmpersandToken */), factory.createBinaryExpression(right, factory.createToken(invert ? 36 /* SyntaxKind.EqualsEqualsEqualsToken */ : 37 /* SyntaxKind.ExclamationEqualsEqualsToken */), factory.createVoidZero()));
97578 }
97579 function transformNullishCoalescingExpression(node) {
97580 var left = ts.visitNode(node.left, visitor, ts.isExpression);
97581 var right = left;
97582 if (!ts.isSimpleCopiableExpression(left)) {
97583 right = factory.createTempVariable(hoistVariableDeclaration);
97584 left = factory.createAssignment(right, left);
97585 }
97586 return ts.setTextRange(factory.createConditionalExpression(createNotNullCondition(left, right),
97587 /*questionToken*/ undefined, right,
97588 /*colonToken*/ undefined, ts.visitNode(node.right, visitor, ts.isExpression)), node);
97589 }
97590 function visitDeleteExpression(node) {
97591 return ts.isOptionalChain(ts.skipParentheses(node.expression))
97592 ? ts.setOriginalNode(visitNonOptionalExpression(node.expression, /*captureThisArg*/ false, /*isDelete*/ true), node)

Callers 1

visitorFunction · 0.85

Calls 1

createNotNullConditionFunction · 0.85

Tested by

no test coverage detected