Modified createIdentifier to track originalKeywordKind

This commit is contained in:
Ron Buckton
2016-03-23 09:40:51 -07:00
parent 63cf58bd09
commit 7f51f7c81d
2 changed files with 7 additions and 7 deletions
+1
View File
@@ -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;
}
+6 -7
View File
@@ -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);