From 17dd6c2de01b4ded0d7afeec39d19f13c0e858a2 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 9 Feb 2015 14:40:03 -0800 Subject: [PATCH] Be more conservative about reusing parameters. --- src/compiler/parser.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 8f7f68d9b6..cd0d86bed4 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1924,9 +1924,13 @@ module ts { } function isReusableParameter(node: Node) { - // TODO: this most likely needs the same initializer check that - // isReusableVariableDeclaration has. - return node.kind === SyntaxKind.Parameter; + if (node.kind !== SyntaxKind.Parameter) { + return false; + } + + // See the comment in isReusableVariableDeclaration for why we do this. + var parameter = node; + return parameter.initializer === undefined; } // Returns true if we should abort parsing.