mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Modified createIdentifier to track originalKeywordKind
This commit is contained in:
@@ -138,6 +138,7 @@ namespace ts {
|
||||
export function createIdentifier(text: string, location?: TextRange): Identifier {
|
||||
const node = <Identifier>createNode(SyntaxKind.Identifier, location);
|
||||
node.text = escapeIdentifier(text);
|
||||
node.originalKeywordKind = stringToToken(text);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace ts {
|
||||
context.enableExpressionSubstitution(SyntaxKind.PrefixUnaryExpression);
|
||||
context.enableExpressionSubstitution(SyntaxKind.PostfixUnaryExpression);
|
||||
context.expressionSubstitution = substituteExpression;
|
||||
|
||||
|
||||
context.enableEmitNotification(SyntaxKind.SourceFile);
|
||||
|
||||
const exportFunctionForFileMap: Identifier[] = [];
|
||||
@@ -125,7 +125,7 @@ namespace ts {
|
||||
createStatement(
|
||||
createCall(
|
||||
createPropertyAccess(createIdentifier("System"), "register"),
|
||||
node.moduleName
|
||||
node.moduleName
|
||||
? [createLiteral(node.moduleName), dependencies, body]
|
||||
: [dependencies, body]
|
||||
)
|
||||
@@ -626,7 +626,7 @@ namespace ts {
|
||||
if (!hasModifier(node, ModifierFlags.Default)) {
|
||||
recordExportName(name);
|
||||
}
|
||||
|
||||
|
||||
node = newNode;
|
||||
}
|
||||
|
||||
@@ -1073,7 +1073,7 @@ namespace ts {
|
||||
function substituteUnaryExpression(node: PrefixUnaryExpression | PostfixUnaryExpression): Expression {
|
||||
const operand = node.operand;
|
||||
const operator = node.operator;
|
||||
const substitute =
|
||||
const substitute =
|
||||
isIdentifier(operand) &&
|
||||
(
|
||||
node.kind === SyntaxKind.PostfixUnaryExpression ||
|
||||
@@ -1090,7 +1090,7 @@ namespace ts {
|
||||
return call;
|
||||
}
|
||||
else {
|
||||
return operator === SyntaxKind.PlusPlusToken
|
||||
return operator === SyntaxKind.PlusPlusToken
|
||||
? createSubtract(call, createLiteral(1))
|
||||
: createAdd(call, createLiteral(1))
|
||||
}
|
||||
@@ -1200,7 +1200,7 @@ namespace ts {
|
||||
)
|
||||
)
|
||||
],
|
||||
/*location*/ undefined,
|
||||
/*location*/ undefined,
|
||||
/*multiline*/ true)
|
||||
)
|
||||
);
|
||||
@@ -1243,7 +1243,6 @@ namespace ts {
|
||||
if (isImportClause(importDeclaration)) {
|
||||
importAlias = getGeneratedNameForNode(importDeclaration.parent);
|
||||
name = createIdentifier("default");
|
||||
name.originalKeywordKind = SyntaxKind.DefaultKeyword;
|
||||
}
|
||||
else if (isImportSpecifier(importDeclaration)) {
|
||||
importAlias = getGeneratedNameForNode(importDeclaration.parent.parent.parent);
|
||||
|
||||
Reference in New Issue
Block a user