Skip to content

Commit 248953e

Browse files
committed
Explicit handling for more nodes in reduceEachChild/visitEachChild
1 parent 1c9df84 commit 248953e

File tree

7 files changed

+1290
-905
lines changed

7 files changed

+1290
-905
lines changed

src/compiler/factory.ts

Lines changed: 542 additions & 102 deletions
Large diffs are not rendered by default.

src/compiler/program.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,7 @@ namespace ts {
14411441
// checked is to not pass the file to getEmitResolver.
14421442
const emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile);
14431443

1444+
performance.emit("beforeEmit");
14441445
const emitStart = performance.mark();
14451446

14461447
const emitResult = emitFiles(
@@ -1449,6 +1450,7 @@ namespace ts {
14491450
sourceFile);
14501451

14511452
performance.measure("emitTime", emitStart);
1453+
performance.emit("afterEmit");
14521454

14531455
return emitResult;
14541456
}

src/compiler/transformers/destructuring.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ namespace ts {
351351
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, location, emitTempVariableAssignment);
352352
return createConditional(
353353
createStrictEquality(value, createVoidZero()),
354+
createToken(SyntaxKind.QuestionToken),
354355
defaultValue,
356+
createToken(SyntaxKind.ColonToken),
355357
value
356358
);
357359
}

src/compiler/transformers/module/module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,10 @@ namespace ts {
734734
statements.push(
735735
setOriginalNode(
736736
createClassDeclaration(
737+
/*decorators*/ undefined,
737738
/*modifiers*/ undefined,
738739
name,
740+
/*typeParameters*/ undefined,
739741
node.heritageClauses,
740742
node.members,
741743
/*location*/ node
@@ -908,7 +910,7 @@ namespace ts {
908910
setNodeEmitFlags(node, NodeEmitFlags.NoSubstitution);
909911
let transformedUnaryExpression: BinaryExpression;
910912
if (node.kind === SyntaxKind.PostfixUnaryExpression) {
911-
transformedUnaryExpression = createBinaryWithOperatorToken(
913+
transformedUnaryExpression = createBinary(
912914
operand,
913915
createNode(operator === SyntaxKind.PlusPlusToken ? SyntaxKind.PlusEqualsToken : SyntaxKind.MinusEqualsToken),
914916
createLiteral(1),

src/compiler/transformers/module/system.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,9 @@ namespace ts {
720720
createAssignment(
721721
name,
722722
createClassExpression(
723+
/*modifiers*/ undefined,
723724
node.name,
725+
/*typeParameters*/ undefined,
724726
node.heritageClauses,
725727
node.members,
726728
/*location*/ node

src/compiler/transformers/ts.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,10 @@ namespace ts {
506506
// ${members}
507507
// }
508508
const classDeclaration = createClassDeclaration(
509+
/*decorators*/ undefined,
509510
visitNodes(node.modifiers, visitor, isModifier),
510511
name,
512+
/*typeParameters*/ undefined,
511513
visitNodes(node.heritageClauses, visitor, isHeritageClause),
512514
transformClassMembers(node, hasExtendsClause),
513515
/*location*/ node
@@ -548,7 +550,7 @@ namespace ts {
548550
}
549551
else if (isDecoratedClass) {
550552
if (isDefaultExternalModuleExport(node)) {
551-
statements.push(createExportDefault(getLocalName(node)));
553+
statements.push(createExportAssignment(/*isExportEquals*/ false, getLocalName(node)));
552554
}
553555
else if (isNamedExternalModuleExport(node)) {
554556
statements.push(createExternalModuleExport(name));
@@ -660,7 +662,9 @@ namespace ts {
660662
// }
661663
const classExpression: Expression = setOriginalNode(
662664
createClassExpression(
665+
/*modifiers*/ undefined,
663666
name,
667+
/*typeParameters*/ undefined,
664668
visitNodes(node.heritageClauses, visitor, isHeritageClause),
665669
transformClassMembers(node, hasExtendsClause),
666670
/*location*/ location
@@ -743,7 +747,9 @@ namespace ts {
743747

744748
const classExpression = setOriginalNode(
745749
createClassExpression(
750+
/*modifiers*/ undefined,
746751
node.name,
752+
/*typeParameters*/ undefined,
747753
heritageClauses,
748754
members,
749755
/*location*/ node
@@ -1871,7 +1877,9 @@ namespace ts {
18711877
createTypeOf(createIdentifier("Symbol")),
18721878
createLiteral("function")
18731879
),
1880+
createToken(SyntaxKind.QuestionToken),
18741881
createIdentifier("Symbol"),
1882+
createToken(SyntaxKind.ColonToken),
18751883
createIdentifier("Object")
18761884
);
18771885
}
@@ -1957,6 +1965,7 @@ namespace ts {
19571965
function visitExpressionWithTypeArguments(node: ExpressionWithTypeArguments): ExpressionWithTypeArguments {
19581966
const expression = visitNode(node.expression, visitor, isLeftHandSideExpression);
19591967
return createExpressionWithTypeArguments(
1968+
/*typeArguments*/ undefined,
19601969
expression,
19611970
node
19621971
);
@@ -2360,6 +2369,7 @@ namespace ts {
23602369
function visitAwaitExpression(node: AwaitExpression): Expression {
23612370
return setOriginalNode(
23622371
createYield(
2372+
/*asteriskToken*/ undefined,
23632373
visitNode(node.expression, visitor, isExpression),
23642374
/*location*/ node
23652375
),

0 commit comments

Comments
 (0)