mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-23 10:29:01 -06:00
Remove ConstantValue flag, comment cleanup.
This commit is contained in:
parent
deae9f211b
commit
f03be92e7d
@ -413,7 +413,7 @@ const _super = (function (geti, seti) {
|
||||
*
|
||||
* NOTE: Do not call this method directly. It is part of the emit pipeline
|
||||
* and should only be called indirectly from pipelineEmitWithSourceMap or
|
||||
* pipelineEmitInUnspecifiedContext (when pickign a more specific context).
|
||||
* pipelineEmitInUnspecifiedContext (when picking a more specific context).
|
||||
*/
|
||||
function pipelineEmitWithSubstitution(emitContext: EmitContext, node: Node) {
|
||||
emitNodeWithSubstitution(emitContext, node, pipelineEmitForContext);
|
||||
@ -1172,7 +1172,7 @@ const _super = (function (geti, seti) {
|
||||
const text = getLiteralTextOfNode(<LiteralExpression>expression);
|
||||
return text.indexOf(tokenToString(SyntaxKind.DotToken)) < 0;
|
||||
}
|
||||
else {
|
||||
else if (isPropertyAccessExpression(expression) || isElementAccessExpression(expression)) {
|
||||
// check if constant enum value is integer
|
||||
const constantValue = getConstantValue(expression);
|
||||
// isFinite handles cases when constantValue is undefined
|
||||
|
||||
@ -2798,17 +2798,20 @@ namespace ts {
|
||||
return tokenSourceMapRanges && tokenSourceMapRanges[token];
|
||||
}
|
||||
|
||||
export function getConstantValue(node: Node) {
|
||||
/**
|
||||
* Gets the constant value to emit for an expression.
|
||||
*/
|
||||
export function getConstantValue(node: PropertyAccessExpression | ElementAccessExpression) {
|
||||
const emitNode = node.emitNode;
|
||||
if (emitNode && emitNode.flags & EmitFlags.ConstantValue) {
|
||||
return emitNode.constantValue;
|
||||
}
|
||||
return emitNode && emitNode.constantValue;
|
||||
}
|
||||
|
||||
export function setConstantValue(node: Node, value: number) {
|
||||
/**
|
||||
* Sets the constant value to emit for an expression.
|
||||
*/
|
||||
export function setConstantValue(node: PropertyAccessExpression | ElementAccessExpression, value: number) {
|
||||
const emitNode = getOrCreateEmitNode(node);
|
||||
emitNode.constantValue = value;
|
||||
emitNode.flags |= EmitFlags.ConstantValue;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
@ -348,7 +348,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits a token of a node node with possible leading and trailing source maps.
|
||||
* Emits a token of a node with possible leading and trailing source maps.
|
||||
*
|
||||
* @param node The node containing the token.
|
||||
* @param token The token to emit.
|
||||
|
||||
@ -3205,7 +3205,6 @@ namespace ts {
|
||||
AsyncFunctionBody = 1 << 21,
|
||||
ReuseTempVariableScope = 1 << 22, // Reuse the existing temp variable scope during emit.
|
||||
CustomPrologue = 1 << 23, // Treat the statement as if it were a prologue directive (NOTE: Prologue directives are *not* transformed).
|
||||
ConstantValue = 1 << 24, // The node was replaced with a constant value during substitution.
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user