From c5ddf27dc68d6dc49a3d6f01e1db35fa6b455b79 Mon Sep 17 00:00:00 2001 From: Andrej Baran Date: Thu, 13 Oct 2016 12:04:36 +0200 Subject: [PATCH] Remove constant substitution from ES2017 transformer --- src/compiler/transformers/es2017.ts | 32 +---------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/src/compiler/transformers/es2017.ts b/src/compiler/transformers/es2017.ts index 1d3c189110a..f9e8b539c6a 100644 --- a/src/compiler/transformers/es2017.ts +++ b/src/compiler/transformers/es2017.ts @@ -395,7 +395,7 @@ namespace ts { } } - return substituteConstantValue(node); + return node; } function substituteElementAccessExpression(node: ElementAccessExpression) { @@ -410,39 +410,9 @@ namespace ts { } } - return substituteConstantValue(node); - } - - function substituteConstantValue(node: PropertyAccessExpression | ElementAccessExpression): LeftHandSideExpression { - const constantValue = tryGetConstEnumValue(node); - if (constantValue !== undefined) { - const substitute = createLiteral(constantValue); - setSourceMapRange(substitute, node); - setCommentRange(substitute, node); - if (!compilerOptions.removeComments) { - const propertyName = isPropertyAccessExpression(node) - ? declarationNameToString(node.name) - : getTextOfNode(node.argumentExpression); - substitute.trailingComment = ` ${propertyName} `; - } - - setConstantValue(node, constantValue); - return substitute; - } - return node; } - function tryGetConstEnumValue(node: Node): number { - if (compilerOptions.isolatedModules) { - return undefined; - } - - return isPropertyAccessExpression(node) || isElementAccessExpression(node) - ? resolver.getConstantValue(node) - : undefined; - } - function substituteCallExpression(node: CallExpression): Expression { const expression = node.expression; if (isSuperProperty(expression)) {