diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index e31989e6726..ba4b1010dba 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1381,14 +1381,13 @@ var __awaiter = (this && this.__awaiter) || function (generator, ctor) { } function needsParenthesisForAwaitExpressionAsYield(node: AwaitExpression) { - for (let current: Node = node; isExpression(current.parent); current = current.parent) { - if (current.parent.kind === SyntaxKind.BinaryExpression) { - if ((current.parent).left === current) { - return true; - } - } + if (node.parent.kind === SyntaxKind.BinaryExpression && !isAssignmentOperator((node.parent).operatorToken.kind)) { + return true; } - + else if (node.parent.kind === SyntaxKind.ConditionalExpression && (node.parent).condition === node) { + return true; + } + return false; }