(node)
| 112310 | emitExpression(node.operand, parenthesizer.parenthesizeOperandOfPrefixUnary); |
| 112311 | } |
| 112312 | function shouldEmitWhitespaceBeforeOperand(node) { |
| 112313 | // In some cases, we need to emit a space between the operator and the operand. One obvious case |
| 112314 | // is when the operator is an identifier, like delete or typeof. We also need to do this for plus |
| 112315 | // and minus expressions in certain cases. Specifically, consider the following two cases (parens |
| 112316 | // are just for clarity of exposition, and not part of the source code): |
| 112317 | // |
| 112318 | // (+(+1)) |
| 112319 | // (+(++1)) |
| 112320 | // |
| 112321 | // We need to emit a space in both cases. In the first case, the absence of a space will make |
| 112322 | // the resulting expression a prefix increment operation. And in the second, it will make the resulting |
| 112323 | // expression a prefix increment whose operand is a plus expression - (++(+x)) |
| 112324 | // The same is true of minus of course. |
| 112325 | var operand = node.operand; |
| 112326 | return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ |
| 112327 | && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) |
| 112328 | || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); |
| 112329 | } |
| 112330 | function emitPostfixUnaryExpression(node) { |
| 112331 | emitExpression(node.operand, parenthesizer.parenthesizeOperandOfPostfixUnary); |
| 112332 | writeTokenText(node.operator, writeOperator); |
no outgoing calls
no test coverage detected