Skip to content

Commit b087526

Browse files
committed
Fix several test failures.
1 parent d119167 commit b087526

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

src/compiler/core.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,9 @@ namespace ts {
355355
export function addRange<T>(to: T[], from: T[]): void {
356356
if (to && from) {
357357
for (const v of from) {
358-
to.push(v);
358+
if (v !== undefined) {
359+
to.push(v);
360+
}
359361
}
360362
}
361363
}

src/compiler/factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2635,8 +2635,8 @@ namespace ts {
26352635
return node;
26362636
}
26372637

2638-
export function startOnNewLine<T extends Node>(node: T, startsOnNewLine?: boolean): T {
2639-
node.startsOnNewLine = startsOnNewLine !== false;
2638+
export function startOnNewLine<T extends Node>(node: T): T {
2639+
node.startsOnNewLine = true;
26402640
return node;
26412641
}
26422642

src/compiler/transformers/es6.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,28 +1899,27 @@ namespace ts {
18991899

19001900
// Write out the first non-computed properties, then emit the rest through indexing on the temp variable.
19011901
const expressions: Expression[] = [];
1902-
expressions.push(
1903-
startOnNewLine(
1904-
createAssignment(
1905-
temp,
1906-
setNodeEmitFlags(
1907-
createObjectLiteral(
1908-
visitNodes(properties, visitor, isObjectLiteralElement, 0, numInitialProperties),
1909-
/*location*/ undefined,
1910-
node.multiLine
1911-
),
1912-
NodeEmitFlags.Indented
1913-
)
1902+
const assignment = createAssignment(
1903+
temp,
1904+
setNodeEmitFlags(
1905+
createObjectLiteral(
1906+
visitNodes(properties, visitor, isObjectLiteralElement, 0, numInitialProperties),
1907+
/*location*/ undefined,
1908+
node.multiLine
19141909
),
1915-
node.multiLine
1910+
NodeEmitFlags.Indented
19161911
)
19171912
);
1913+
if (node.multiLine) {
1914+
assignment.startsOnNewLine = true;
1915+
}
1916+
expressions.push(assignment);
19181917

19191918
addObjectLiteralMembers(expressions, node, temp, numInitialProperties);
19201919

19211920
// We need to clone the temporary identifier so that we can write it on a
19221921
// new line
1923-
expressions.push(startOnNewLine(getMutableClone(temp), node.multiLine));
1922+
expressions.push(node.multiLine ? startOnNewLine(getMutableClone(temp)) : temp);
19241923
return inlineExpressions(expressions);
19251924
}
19261925

src/compiler/visitor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,19 +827,19 @@ namespace ts {
827827

828828
case SyntaxKind.DeleteExpression:
829829
return updateDelete(<DeleteExpression>node,
830-
visitNode((<DeleteExpression>node).expression, visitor, isUnaryExpression));
830+
visitNode((<DeleteExpression>node).expression, visitor, isExpression));
831831

832832
case SyntaxKind.TypeOfExpression:
833833
return updateTypeOf(<TypeOfExpression>node,
834-
visitNode((<TypeOfExpression>node).expression, visitor, isUnaryExpression));
834+
visitNode((<TypeOfExpression>node).expression, visitor, isExpression));
835835

836836
case SyntaxKind.VoidExpression:
837837
return updateVoid(<VoidExpression>node,
838-
visitNode((<VoidExpression>node).expression, visitor, isUnaryExpression));
838+
visitNode((<VoidExpression>node).expression, visitor, isExpression));
839839

840840
case SyntaxKind.AwaitExpression:
841841
return updateAwait(<AwaitExpression>node,
842-
visitNode((<AwaitExpression>node).expression, visitor, isUnaryExpression));
842+
visitNode((<AwaitExpression>node).expression, visitor, isExpression));
843843

844844
case SyntaxKind.BinaryExpression:
845845
return updateBinary(<BinaryExpression>node,

0 commit comments

Comments
 (0)