From e940fdc534f0c8de8794274a84264efe67299c57 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 3 Jun 2015 17:34:56 -0700 Subject: [PATCH] Don't use innerExpression in parenthesizeForAccess --- src/compiler/emitter.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 5a0db87d40..bf0aef7445 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1646,9 +1646,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { function parenthesizeForAccess(expr: Expression): LeftHandSideExpression { // When diagnosing whether the expression needs parentheses, the decision should be based // on the innermost expression in a chain of nested type assertions. - let innerExpression = expr; - while (innerExpression.kind === SyntaxKind.TypeAssertionExpression) { - innerExpression = (innerExpression).expression; + while (expr.kind === SyntaxKind.TypeAssertionExpression) { + expr = (expr).expression; } // isLeftHandSideExpression is almost the correct criterion for when it is not necessary @@ -1659,9 +1658,9 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { // NumberLiteral // 1.x -> not the same as (1).x // - if (isLeftHandSideExpression(innerExpression) && - innerExpression.kind !== SyntaxKind.NewExpression && - innerExpression.kind !== SyntaxKind.NumericLiteral) { + if (isLeftHandSideExpression(expr) && + expr.kind !== SyntaxKind.NewExpression && + expr.kind !== SyntaxKind.NumericLiteral) { return expr; }