mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-14 07:02:44 -05:00
Simplified parenthesis check for await as yield.
This commit is contained in:
@@ -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 ((<BinaryExpression>current.parent).left === current) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (node.parent.kind === SyntaxKind.BinaryExpression && !isAssignmentOperator((<BinaryExpression>node.parent).operatorToken.kind)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (node.parent.kind === SyntaxKind.ConditionalExpression && (<ConditionalExpression>node.parent).condition === node) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user