Skip to content

Commit df3a74b

Browse files
committed
Removed some unnecessary changes and added comments
1 parent 9c413f7 commit df3a74b

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

src/compiler/emitter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2832,6 +2832,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
28322832
else {
28332833
write("var ");
28342834
}
2835+
// Note here we specifically dont emit end so that if we are going to emit binding pattern
2836+
// we can alter the source map correctly
28352837
return true;
28362838
}
28372839

@@ -3732,7 +3734,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
37323734
const isVariableDeclarationOrBindingElement =
37333735
name.parent && (name.parent.kind === SyntaxKind.VariableDeclaration || name.parent.kind === SyntaxKind.BindingElement);
37343736

3735-
// If this is first var declaration, we need to stary at var/let/const keyword instead
3737+
// If this is first var declaration, we need to start at var/let/const keyword instead
37363738
// otherwise use nodeForSourceMap as the start position
37373739
emitStart(isFirstVariableDeclaration(nodeForSourceMap) ? nodeForSourceMap.parent : nodeForSourceMap);
37383740
withTemporaryNoSourceMap(() => {

src/compiler/sourcemap.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,20 +232,17 @@ namespace ts {
232232
sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan);
233233
}
234234

235-
function getSourceLinePos(pos: number) {
236-
const sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos);
237-
// Convert the location to be one-based.
238-
sourceLinePos.line++;
239-
sourceLinePos.character++;
240-
return sourceLinePos;
241-
}
242-
243235
function emitPos(pos: number) {
244236
if (pos === -1) {
245237
return;
246238
}
247239

248-
const sourceLinePos = getSourceLinePos(pos);
240+
const sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos);
241+
242+
// Convert the location to be one-based.
243+
sourceLinePos.line++;
244+
sourceLinePos.character++;
245+
249246
const emittedLine = writer.getLine();
250247
const emittedColumn = writer.getColumn();
251248

src/compiler/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,7 @@ namespace ts {
16161616
return node.kind === SyntaxKind.QualifiedName;
16171617
}
16181618

1619-
export function nodeIsSynthesized(node: Node | TextRange): boolean {
1619+
export function nodeIsSynthesized(node: Node): boolean {
16201620
return node.pos === -1;
16211621
}
16221622

0 commit comments

Comments
 (0)