File tree 4 files changed +12
-10
lines changed
4 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -413,7 +413,7 @@ const _super = (function (geti, seti) {
413
413
*
414
414
* NOTE: Do not call this method directly. It is part of the emit pipeline
415
415
* and should only be called indirectly from pipelineEmitWithSourceMap or
416
- * pipelineEmitInUnspecifiedContext (when pickign a more specific context).
416
+ * pipelineEmitInUnspecifiedContext (when picking a more specific context).
417
417
*/
418
418
function pipelineEmitWithSubstitution ( emitContext : EmitContext , node : Node ) {
419
419
emitNodeWithSubstitution ( emitContext , node , pipelineEmitForContext ) ;
@@ -1172,7 +1172,7 @@ const _super = (function (geti, seti) {
1172
1172
const text = getLiteralTextOfNode ( < LiteralExpression > expression ) ;
1173
1173
return text . indexOf ( tokenToString ( SyntaxKind . DotToken ) ) < 0 ;
1174
1174
}
1175
- else {
1175
+ else if ( isPropertyAccessExpression ( expression ) || isElementAccessExpression ( expression ) ) {
1176
1176
// check if constant enum value is integer
1177
1177
const constantValue = getConstantValue ( expression ) ;
1178
1178
// isFinite handles cases when constantValue is undefined
Original file line number Diff line number Diff line change @@ -2798,17 +2798,20 @@ namespace ts {
2798
2798
return tokenSourceMapRanges && tokenSourceMapRanges [ token ] ;
2799
2799
}
2800
2800
2801
- export function getConstantValue ( node : Node ) {
2801
+ /**
2802
+ * Gets the constant value to emit for an expression.
2803
+ */
2804
+ export function getConstantValue ( node : PropertyAccessExpression | ElementAccessExpression ) {
2802
2805
const emitNode = node . emitNode ;
2803
- if ( emitNode && emitNode . flags & EmitFlags . ConstantValue ) {
2804
- return emitNode . constantValue ;
2805
- }
2806
+ return emitNode && emitNode . constantValue ;
2806
2807
}
2807
2808
2808
- export function setConstantValue ( node : Node , value : number ) {
2809
+ /**
2810
+ * Sets the constant value to emit for an expression.
2811
+ */
2812
+ export function setConstantValue ( node : PropertyAccessExpression | ElementAccessExpression , value : number ) {
2809
2813
const emitNode = getOrCreateEmitNode ( node ) ;
2810
2814
emitNode . constantValue = value ;
2811
- emitNode . flags |= EmitFlags . ConstantValue ;
2812
2815
return node ;
2813
2816
}
2814
2817
Original file line number Diff line number Diff line change @@ -348,7 +348,7 @@ namespace ts {
348
348
}
349
349
350
350
/**
351
- * Emits a token of a node node with possible leading and trailing source maps.
351
+ * Emits a token of a node with possible leading and trailing source maps.
352
352
*
353
353
* @param node The node containing the token.
354
354
* @param token The token to emit.
Original file line number Diff line number Diff line change @@ -3205,7 +3205,6 @@ namespace ts {
3205
3205
AsyncFunctionBody = 1 << 21 ,
3206
3206
ReuseTempVariableScope = 1 << 22 , // Reuse the existing temp variable scope during emit.
3207
3207
CustomPrologue = 1 << 23 , // Treat the statement as if it were a prologue directive (NOTE: Prologue directives are *not* transformed).
3208
- ConstantValue = 1 << 24 , // The node was replaced with a constant value during substitution.
3209
3208
}
3210
3209
3211
3210
/* @internal */
You can’t perform that action at this time.
0 commit comments