Skip to content

Commit 7d60c5e

Browse files
committed
Fix the temporary assignment source maps in a better way
This doesnt create synthetic nodes with source map node on them And makes us determine what to put source map on for temporary assignments
1 parent 8948f9b commit 7d60c5e

25 files changed

Lines changed: 1733 additions & 1760 deletions

File tree

src/compiler/emitter.ts

Lines changed: 49 additions & 33 deletions
Large diffs are not rendered by default.

src/compiler/sourcemap.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,7 @@ namespace ts {
281281
updateLastEncodedAndRecordedSpans();
282282
}
283283

284-
function getSourceMapRange(range: TextRange) {
285-
while ((range as SynthesizedNode).sourceMapNode) {
286-
range = (range as SynthesizedNode).sourceMapNode;
287-
}
288-
return range;
289-
}
290-
291284
function getStartPos(range: TextRange) {
292-
range = getSourceMapRange(range);
293285
const rangeHasDecorators = !!(range as Node).decorators;
294286
return range.pos !== -1 ? skipTrivia(currentSourceFile.text, rangeHasDecorators ? (range as Node).decorators.end : range.pos) : -1;
295287
}
@@ -299,7 +291,6 @@ namespace ts {
299291
}
300292

301293
function emitEnd(range: TextRange, stopOverridingEnd?: boolean) {
302-
range = getSourceMapRange(range);
303294
emitPos(range.end);
304295
stopOverridingSpan = stopOverridingEnd;
305296
}

src/compiler/utilities.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ namespace ts {
1212
leadingCommentRanges?: CommentRange[];
1313
trailingCommentRanges?: CommentRange[];
1414
startsOnNewLine: boolean;
15-
sourceMapNode?: Node;
1615
}
1716

1817
export function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Declaration {
@@ -1627,12 +1626,6 @@ namespace ts {
16271626
return node;
16281627
}
16291628

1630-
export function createSourceMappedSynthesizedNode(kind: SyntaxKind, sourceMapNode: Node, startsOnNewLine?: boolean): Node {
1631-
const synthesizedNode = <SynthesizedNode>createSynthesizedNode(kind, startsOnNewLine);
1632-
synthesizedNode.sourceMapNode = sourceMapNode;
1633-
return synthesizedNode;
1634-
}
1635-
16361629
export function createSynthesizedNodeArray(): NodeArray<any> {
16371630
const array = <NodeArray<any>>[];
16381631
array.pos = -1;

tests/baselines/reference/sourceMapValidationDestructuringForArrayBindingPattern.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)