From 95e7015fa05ae2bf8b41c62abbf619c06d8ffd10 Mon Sep 17 00:00:00 2001 From: Stan Thomas Date: Fri, 30 Jan 2015 06:09:31 -0500 Subject: [PATCH] Supress const enum member value comment from emitted javascript in presence of --removeComments (revised) --- src/compiler/emitter.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 0b6badb7b43..4405b895d59 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2462,8 +2462,11 @@ module ts { function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean { var constantValue = resolver.getConstantValue(node); if (constantValue !== undefined) { - var propertyName = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((node).name) : getTextOfNode((node).argumentExpression); - write(constantValue.toString() + (!compilerOptions.removeComments ? " /* " + propertyName + " */" : "")); + write(constantValue.toString()); + if (!compilerOptions.removeComments) { + var propertyName: string = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((node).name) : getTextOfNode((node).argumentExpression); + write(" /* " + propertyName + " */"); + } return true; } return false;