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;