Skip to content

Commit c5ddf27

Browse files
committed
Remove constant substitution from ES2017 transformer
1 parent 7df3fda commit c5ddf27

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

src/compiler/transformers/es2017.ts

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ namespace ts {
395395
}
396396
}
397397

398-
return substituteConstantValue(node);
398+
return node;
399399
}
400400

401401
function substituteElementAccessExpression(node: ElementAccessExpression) {
@@ -410,39 +410,9 @@ namespace ts {
410410
}
411411
}
412412

413-
return substituteConstantValue(node);
414-
}
415-
416-
function substituteConstantValue(node: PropertyAccessExpression | ElementAccessExpression): LeftHandSideExpression {
417-
const constantValue = tryGetConstEnumValue(node);
418-
if (constantValue !== undefined) {
419-
const substitute = createLiteral(constantValue);
420-
setSourceMapRange(substitute, node);
421-
setCommentRange(substitute, node);
422-
if (!compilerOptions.removeComments) {
423-
const propertyName = isPropertyAccessExpression(node)
424-
? declarationNameToString(node.name)
425-
: getTextOfNode(node.argumentExpression);
426-
substitute.trailingComment = ` ${propertyName} `;
427-
}
428-
429-
setConstantValue(node, constantValue);
430-
return substitute;
431-
}
432-
433413
return node;
434414
}
435415

436-
function tryGetConstEnumValue(node: Node): number {
437-
if (compilerOptions.isolatedModules) {
438-
return undefined;
439-
}
440-
441-
return isPropertyAccessExpression(node) || isElementAccessExpression(node)
442-
? resolver.getConstantValue(<PropertyAccessExpression | ElementAccessExpression>node)
443-
: undefined;
444-
}
445-
446416
function substituteCallExpression(node: CallExpression): Expression {
447417
const expression = node.expression;
448418
if (isSuperProperty(expression)) {

0 commit comments

Comments
 (0)