Skip to content

Commit f03be92

Browse files
committed
Remove ConstantValue flag, comment cleanup.
1 parent deae9f2 commit f03be92

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

src/compiler/emitter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ const _super = (function (geti, seti) {
413413
*
414414
* NOTE: Do not call this method directly. It is part of the emit pipeline
415415
* 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).
417417
*/
418418
function pipelineEmitWithSubstitution(emitContext: EmitContext, node: Node) {
419419
emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext);
@@ -1172,7 +1172,7 @@ const _super = (function (geti, seti) {
11721172
const text = getLiteralTextOfNode(<LiteralExpression>expression);
11731173
return text.indexOf(tokenToString(SyntaxKind.DotToken)) < 0;
11741174
}
1175-
else {
1175+
else if (isPropertyAccessExpression(expression) || isElementAccessExpression(expression)) {
11761176
// check if constant enum value is integer
11771177
const constantValue = getConstantValue(expression);
11781178
// isFinite handles cases when constantValue is undefined

src/compiler/factory.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,17 +2798,20 @@ namespace ts {
27982798
return tokenSourceMapRanges && tokenSourceMapRanges[token];
27992799
}
28002800

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) {
28022805
const emitNode = node.emitNode;
2803-
if (emitNode && emitNode.flags & EmitFlags.ConstantValue) {
2804-
return emitNode.constantValue;
2805-
}
2806+
return emitNode && emitNode.constantValue;
28062807
}
28072808

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) {
28092813
const emitNode = getOrCreateEmitNode(node);
28102814
emitNode.constantValue = value;
2811-
emitNode.flags |= EmitFlags.ConstantValue;
28122815
return node;
28132816
}
28142817

src/compiler/sourcemap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ namespace ts {
348348
}
349349

350350
/**
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.
352352
*
353353
* @param node The node containing the token.
354354
* @param token The token to emit.

src/compiler/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3205,7 +3205,6 @@ namespace ts {
32053205
AsyncFunctionBody = 1 << 21,
32063206
ReuseTempVariableScope = 1 << 22, // Reuse the existing temp variable scope during emit.
32073207
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.
32093208
}
32103209

32113210
/* @internal */

0 commit comments

Comments
 (0)