(node, valueIsDiscarded)
| 107044 | } |
| 107045 | } |
| 107046 | function visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded) { |
| 107047 | // When we see a prefix or postfix increment expression whose operand is an exported |
| 107048 | // symbol, we should ensure all exports of that symbol are updated with the correct |
| 107049 | // value. |
| 107050 | // |
| 107051 | // - We do not transform generated identifiers for any reason. |
| 107052 | // - We do not transform identifiers tagged with the LocalName flag. |
| 107053 | // - We do not transform identifiers that were originally the name of an enum or |
| 107054 | // namespace due to how they are transformed in TypeScript. |
| 107055 | // - We only transform identifiers that are exported at the top level. |
| 107056 | if ((node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) |
| 107057 | && ts.isIdentifier(node.operand) |
| 107058 | && !ts.isGeneratedIdentifier(node.operand) |
| 107059 | && !ts.isLocalName(node.operand) |
| 107060 | && !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) { |
| 107061 | var exportedNames = getExports(node.operand); |
| 107062 | if (exportedNames) { |
| 107063 | var temp = void 0; |
| 107064 | var expression = ts.visitNode(node.operand, visitor, ts.isExpression); |
| 107065 | if (ts.isPrefixUnaryExpression(node)) { |
| 107066 | expression = factory.updatePrefixUnaryExpression(node, expression); |
| 107067 | } |
| 107068 | else { |
| 107069 | expression = factory.updatePostfixUnaryExpression(node, expression); |
| 107070 | if (!valueIsDiscarded) { |
| 107071 | temp = factory.createTempVariable(hoistVariableDeclaration); |
| 107072 | expression = factory.createAssignment(temp, expression); |
| 107073 | ts.setTextRange(expression, node); |
| 107074 | } |
| 107075 | expression = factory.createComma(expression, factory.cloneNode(node.operand)); |
| 107076 | ts.setTextRange(expression, node); |
| 107077 | } |
| 107078 | for (var _i = 0, exportedNames_4 = exportedNames; _i < exportedNames_4.length; _i++) { |
| 107079 | var exportName = exportedNames_4[_i]; |
| 107080 | expression = createExportExpression(exportName, preventSubstitution(expression)); |
| 107081 | } |
| 107082 | if (temp) { |
| 107083 | expression = factory.createComma(expression, temp); |
| 107084 | ts.setTextRange(expression, node); |
| 107085 | } |
| 107086 | return expression; |
| 107087 | } |
| 107088 | } |
| 107089 | return ts.visitEachChild(node, visitor, context); |
| 107090 | } |
| 107091 | // |
| 107092 | // Modifier Visitors |
| 107093 | // |
no test coverage detected