Skip to content

Commit 0a0cacf

Browse files
committed
Remove specialized source map emit for rest parameters
1 parent b087526 commit 0a0cacf

13 files changed

+54
-80
lines changed

src/compiler/emitter.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,31 +1443,6 @@ const _super = (function (geti, seti) {
14431443
}
14441444

14451445
function emitForStatement(node: ForStatement) {
1446-
if (node.emitFlags & NodeEmitFlags.SourceMapAdjustRestParameterLoop) {
1447-
// TODO(rbuckton): This should be removed once source maps are aligned with the old
1448-
// emitter and new baselines are taken. This exists solely to
1449-
// align with the old emitter.
1450-
const openParenPos = writeToken(SyntaxKind.ForKeyword, node.pos);
1451-
write(" ");
1452-
writeToken(SyntaxKind.OpenParenToken, openParenPos);
1453-
const initializer = node.initializer;
1454-
initializer.emitFlags |= NodeEmitFlags.NoTrailingSourceMap;
1455-
emitForBinding(initializer);
1456-
write(";");
1457-
emitEnd(initializer);
1458-
const condition = node.condition;
1459-
condition.emitFlags |= NodeEmitFlags.NoTrailingSourceMap;
1460-
write(" ");
1461-
emitExpression(condition);
1462-
write(";");
1463-
emitEnd(condition);
1464-
write(" ");
1465-
emitExpression(node.incrementor);
1466-
write(")");
1467-
emitEmbeddedStatement(node.statement);
1468-
return;
1469-
}
1470-
14711446
const openParenPos = writeToken(SyntaxKind.ForKeyword, node.pos);
14721447
write(" ");
14731448
writeToken(SyntaxKind.OpenParenToken, openParenPos, /*contextNode*/ node);

src/compiler/transformers/es6.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ namespace ts {
10741074
])
10751075
);
10761076

1077-
setNodeEmitFlags(forStatement, NodeEmitFlags.SourceMapAdjustRestParameterLoop | NodeEmitFlags.CustomPrologue);
1077+
setNodeEmitFlags(forStatement, NodeEmitFlags.CustomPrologue);
10781078
startOnNewLine(forStatement);
10791079
statements.push(forStatement);
10801080
}

src/compiler/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3116,7 +3116,6 @@ namespace ts {
31163116
// emitter and new baselines are taken. This exists solely to
31173117
// align with the old emitter.
31183118
SourceMapEmitOpenBraceAsToken = 1 << 24, // Emits the open brace of a block function body as a source mapped token.
3119-
SourceMapAdjustRestParameterLoop = 1 << 25, // Emits adjusted source map positions for a ForStatement generated when transforming a rest parameter for ES5/3.
31203119
}
31213120

31223121
/** Additional context provided to `visitEachChild` */

tests/baselines/reference/sourceMapSample.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/sourceMapSample.sourcemap.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,21 +431,21 @@ sourceFile:sourceMapSample.ts
431431
---
432432
>>> for (var _i = 1; _i < arguments.length; _i++) {
433433
1->^^^^^^^^^^^^^^^^^
434-
2 > ^^^^^^^^^^^
435-
3 > ^
436-
4 > ^^^^^^^^^^^^^^^^^^^^^^
437-
5 > ^
434+
2 > ^^^^^^^^^^
435+
3 > ^^
436+
4 > ^^^^^^^^^^^^^^^^^^^^^
437+
5 > ^^
438438
6 > ^^^^
439439
1->
440440
2 > ...restGreetings: string[]
441-
3 >
441+
3 >
442442
4 > ...restGreetings: string[]
443-
5 >
443+
5 >
444444
6 > ...restGreetings: string[]
445445
1->Emitted(22, 18) Source(21, 37) + SourceIndex(0)
446-
2 >Emitted(22, 29) Source(21, 63) + SourceIndex(0)
446+
2 >Emitted(22, 28) Source(21, 63) + SourceIndex(0)
447447
3 >Emitted(22, 30) Source(21, 37) + SourceIndex(0)
448-
4 >Emitted(22, 52) Source(21, 63) + SourceIndex(0)
448+
4 >Emitted(22, 51) Source(21, 63) + SourceIndex(0)
449449
5 >Emitted(22, 53) Source(21, 37) + SourceIndex(0)
450450
6 >Emitted(22, 57) Source(21, 63) + SourceIndex(0)
451451
---

tests/baselines/reference/sourceMapValidationClass.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/sourceMapValidationClass.sourcemap.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@ sourceFile:sourceMapValidationClass.ts
3737
---
3838
>>> for (var _i = 1; _i < arguments.length; _i++) {
3939
1->^^^^^^^^^^^^^
40-
2 > ^^^^^^^^^^^
41-
3 > ^
42-
4 > ^^^^^^^^^^^^^^^^^^^^^^
43-
5 > ^
40+
2 > ^^^^^^^^^^
41+
3 > ^^
42+
4 > ^^^^^^^^^^^^^^^^^^^^^
43+
5 > ^^
4444
6 > ^^^^
4545
1->
4646
2 > ...b: string[]
47-
3 >
47+
3 >
4848
4 > ...b: string[]
49-
5 >
49+
5 >
5050
6 > ...b: string[]
5151
1->Emitted(4, 14) Source(2, 42) + SourceIndex(0)
52-
2 >Emitted(4, 25) Source(2, 56) + SourceIndex(0)
52+
2 >Emitted(4, 24) Source(2, 56) + SourceIndex(0)
5353
3 >Emitted(4, 26) Source(2, 42) + SourceIndex(0)
54-
4 >Emitted(4, 48) Source(2, 56) + SourceIndex(0)
54+
4 >Emitted(4, 47) Source(2, 56) + SourceIndex(0)
5555
5 >Emitted(4, 49) Source(2, 42) + SourceIndex(0)
5656
6 >Emitted(4, 53) Source(2, 56) + SourceIndex(0)
5757
---

tests/baselines/reference/sourceMapValidationClasses.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/sourceMapValidationClasses.sourcemap.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,21 +439,21 @@ sourceFile:sourceMapValidationClasses.ts
439439
---
440440
>>> for (var _i = 1; _i < arguments.length; _i++) {
441441
1->^^^^^^^^^^^^^^^^^
442-
2 > ^^^^^^^^^^^
443-
3 > ^
444-
4 > ^^^^^^^^^^^^^^^^^^^^^^
445-
5 > ^
442+
2 > ^^^^^^^^^^
443+
3 > ^^
444+
4 > ^^^^^^^^^^^^^^^^^^^^^
445+
5 > ^^
446446
6 > ^^^^
447447
1->
448448
2 > ...restGreetings /* more greeting */: string[]
449-
3 >
449+
3 >
450450
4 > ...restGreetings /* more greeting */: string[]
451-
5 >
451+
5 >
452452
6 > ...restGreetings /* more greeting */: string[]
453453
1->Emitted(22, 18) Source(21, 37) + SourceIndex(0)
454-
2 >Emitted(22, 29) Source(21, 83) + SourceIndex(0)
454+
2 >Emitted(22, 28) Source(21, 83) + SourceIndex(0)
455455
3 >Emitted(22, 30) Source(21, 37) + SourceIndex(0)
456-
4 >Emitted(22, 52) Source(21, 83) + SourceIndex(0)
456+
4 >Emitted(22, 51) Source(21, 83) + SourceIndex(0)
457457
5 >Emitted(22, 53) Source(21, 37) + SourceIndex(0)
458458
6 >Emitted(22, 57) Source(21, 83) + SourceIndex(0)
459459
---

tests/baselines/reference/sourceMapValidationDecorators.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)