Merge pull request #1855 from stanthomas/master

issue #1833 : const enum: supress value comment in emitted javascript
This commit is contained in:
Mohamed Hegazy
2015-02-02 16:35:11 -08:00
4 changed files with 37 additions and 2 deletions

View File

@@ -2461,8 +2461,11 @@ module ts {
function tryEmitConstantValue(node: PropertyAccessExpression | ElementAccessExpression): boolean {
var constantValue = resolver.getConstantValue(node);
if (constantValue !== undefined) {
var propertyName = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((<PropertyAccessExpression>node).name) : getTextOfNode((<ElementAccessExpression>node).argumentExpression);
write(constantValue.toString() + " /* " + propertyName + " */");
write(constantValue.toString());
if (!compilerOptions.removeComments) {
var propertyName: string = node.kind === SyntaxKind.PropertyAccessExpression ? declarationNameToString((<PropertyAccessExpression>node).name) : getTextOfNode((<ElementAccessExpression>node).argumentExpression);
write(" /* " + propertyName + " */");
}
return true;
}
return false;