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

Function emitConditionalExpression

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

Source from the content-addressed store, hash-verified

112421 }
112422 }
112423 function emitConditionalExpression(node) {
112424 var linesBeforeQuestion = getLinesBetweenNodes(node, node.condition, node.questionToken);
112425 var linesAfterQuestion = getLinesBetweenNodes(node, node.questionToken, node.whenTrue);
112426 var linesBeforeColon = getLinesBetweenNodes(node, node.whenTrue, node.colonToken);
112427 var linesAfterColon = getLinesBetweenNodes(node, node.colonToken, node.whenFalse);
112428 emitExpression(node.condition, parenthesizer.parenthesizeConditionOfConditionalExpression);
112429 writeLinesAndIndent(linesBeforeQuestion, /*writeSpaceIfNotIndenting*/ true);
112430 emit(node.questionToken);
112431 writeLinesAndIndent(linesAfterQuestion, /*writeSpaceIfNotIndenting*/ true);
112432 emitExpression(node.whenTrue, parenthesizer.parenthesizeBranchOfConditionalExpression);
112433 decreaseIndentIf(linesBeforeQuestion, linesAfterQuestion);
112434 writeLinesAndIndent(linesBeforeColon, /*writeSpaceIfNotIndenting*/ true);
112435 emit(node.colonToken);
112436 writeLinesAndIndent(linesAfterColon, /*writeSpaceIfNotIndenting*/ true);
112437 emitExpression(node.whenFalse, parenthesizer.parenthesizeBranchOfConditionalExpression);
112438 decreaseIndentIf(linesBeforeColon, linesAfterColon);
112439 }
112440 function emitTemplateExpression(node) {
112441 emit(node.head);
112442 emitList(node, node.templateSpans, 262144 /* ListFormat.TemplateExpressionSpans */);

Callers 1

Calls 5

getLinesBetweenNodesFunction · 0.85
emitExpressionFunction · 0.85
writeLinesAndIndentFunction · 0.85
decreaseIndentIfFunction · 0.85
emitFunction · 0.70

Tested by

no test coverage detected