Skip to content

Commit 5fbb326

Browse files
committed
Fix various linter warnings.
1 parent 08bd78e commit 5fbb326

9 files changed

Lines changed: 19 additions & 50 deletions

File tree

src/compiler/comments.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ namespace ts {
296296
},
297297
emitTrailingComments(range: TextRange, comments: CommentRange[]): void {
298298
const commentStart = performance.mark();
299-
emitLeadingComments(range, comments);
299+
emitTrailingComments(range, comments);
300300
performance.measure("commentTime", commentStart);
301301
},
302302
emitLeadingDetachedComments(range: TextRange, contextNode?: Node, ignoreNodeCallback?: (contextNode: Node) => boolean): void {

src/compiler/factory.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
/* @internal */
55
namespace ts {
6-
const synthesizedLocation: TextRange = { pos: -1, end: -1 };
7-
86
let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
97
let SourceFileConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
108

@@ -151,7 +149,8 @@ namespace ts {
151149
name.text = "";
152150
name.originalKeywordKind = SyntaxKind.Unknown;
153151
name.autoGenerateKind = GeneratedIdentifierKind.Auto;
154-
name.autoGenerateId = nextAutoGenerateId++;
152+
name.autoGenerateId = nextAutoGenerateId;
153+
nextAutoGenerateId++;
155154
if (recordTempVariable) {
156155
recordTempVariable(name);
157156
}
@@ -163,7 +162,8 @@ namespace ts {
163162
name.text = "";
164163
name.originalKeywordKind = SyntaxKind.Unknown;
165164
name.autoGenerateKind = GeneratedIdentifierKind.Loop;
166-
name.autoGenerateId = nextAutoGenerateId++;
165+
name.autoGenerateId = nextAutoGenerateId;
166+
nextAutoGenerateId++;
167167
return name;
168168
}
169169

@@ -172,7 +172,8 @@ namespace ts {
172172
name.text = text;
173173
name.originalKeywordKind = SyntaxKind.Unknown;
174174
name.autoGenerateKind = GeneratedIdentifierKind.Unique;
175-
name.autoGenerateId = nextAutoGenerateId++;
175+
name.autoGenerateId = nextAutoGenerateId;
176+
nextAutoGenerateId++;
176177
return name;
177178
}
178179

@@ -182,7 +183,8 @@ namespace ts {
182183
name.text = "";
183184
name.originalKeywordKind = SyntaxKind.Unknown;
184185
name.autoGenerateKind = GeneratedIdentifierKind.Node;
185-
name.autoGenerateId = nextAutoGenerateId++;
186+
name.autoGenerateId = nextAutoGenerateId;
187+
nextAutoGenerateId++;
186188
return name;
187189
}
188190

src/compiler/sourcemap.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,6 @@ namespace ts {
508508
return skipTrivia(currentSourceText, rangeHasDecorators ? (range as Node).decorators.end : range.pos);
509509
}
510510

511-
function getStartPos(range: TextRange) {
512-
return skipTrivia(currentSourceText, range.pos);
513-
}
514-
515511
/**
516512
* Emits a mapping for the start of a range.
517513
*

src/compiler/transformer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ namespace ts {
156156
* @param transforms An array of Transformers.
157157
*/
158158
export function transformFiles(resolver: EmitResolver, host: EmitHost, sourceFiles: SourceFile[], transformers: Transformer[]) {
159-
const transformId = nextTransformId++;
159+
const transformId = nextTransformId;
160+
nextTransformId++;
161+
160162
const tokenSourceMapRanges: Map<TextRange> = { };
161163
const lexicalEnvironmentVariableDeclarationsStack: VariableDeclaration[][] = [];
162164
const lexicalEnvironmentFunctionDeclarationsStack: FunctionDeclaration[][] = [];

src/compiler/transformers/es6.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,20 +2918,6 @@ namespace ts {
29182918
return getDeclarationName(node, allowComments, allowSourceMaps, NodeEmitFlags.LocalName);
29192919
}
29202920

2921-
/**
2922-
* Gets the export name for a declaration for use in expressions.
2923-
*
2924-
* An export name will *always* be prefixed with an module or namespace export modifier
2925-
* like "exports." if one is required.
2926-
*
2927-
* @param node The declaration.
2928-
* @param allowComments A value indicating whether comments may be emitted for the name.
2929-
* @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
2930-
*/
2931-
function getExportName(node: ClassDeclaration | ClassExpression | FunctionDeclaration, allowComments?: boolean, allowSourceMaps?: boolean) {
2932-
return getDeclarationName(node, allowComments, allowSourceMaps, NodeEmitFlags.ExportName);
2933-
}
2934-
29352921
/**
29362922
* Gets the name of a declaration, without source map or comments.
29372923
*

src/compiler/transformers/module/es6.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace ts {
5050
return undefined; // do not emit export equals for ES6
5151
}
5252
const original = getOriginalNode(node);
53-
return nodeIsSynthesized(original) || resolver.isValueAliasDeclaration(original) ? node: undefined;
53+
return nodeIsSynthesized(original) || resolver.isValueAliasDeclaration(original) ? node : undefined;
5454
}
5555

5656
function visitExportDeclaration(node: ExportDeclaration): ExportDeclaration {
@@ -64,7 +64,7 @@ namespace ts {
6464
if (node.exportClause === newExportClause) {
6565
return node;
6666
}
67-
return newExportClause
67+
return newExportClause
6868
? createExportDeclaration(newExportClause, node.moduleSpecifier)
6969
: undefined;
7070
}
@@ -106,12 +106,12 @@ namespace ts {
106106
const newNamedBindings = visitNode(node.namedBindings, visitor, isNamedImportBindings, /*optional*/ true);
107107
return newDefaultImport !== node.name || newNamedBindings !== node.namedBindings
108108
? createImportClause(newDefaultImport, newNamedBindings)
109-
: node;
109+
: node;
110110
}
111111

112112
function visitNamedBindings(node: NamedImportBindings): VisitResult<NamedImportBindings> {
113113
if (node.kind === SyntaxKind.NamespaceImport) {
114-
return resolver.isReferencedAliasDeclaration(node) ? node: undefined;
114+
return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
115115
}
116116
else {
117117
const newNamedImportElements = visitNodes((<NamedImports>node).elements, visitor, isImportSpecifier);

src/compiler/transformers/module/module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ namespace ts {
619619
if (hasModifier(node, ModifierFlags.Export)) {
620620
const variables = getInitializedVariables(node.declarationList);
621621
if (variables.length > 0) {
622-
let inlineAssignments = createStatement(
622+
const inlineAssignments = createStatement(
623623
inlineExpressions(
624624
map(variables, transformInitializedVariable)
625625
),
@@ -648,7 +648,7 @@ namespace ts {
648648
function addExportMemberAssignmentsForBindingName(resultStatements: Statement[], name: BindingName): void {
649649
if (isBindingPattern(name)) {
650650
for (const element of name.elements) {
651-
addExportMemberAssignmentsForBindingName(resultStatements, element.name)
651+
addExportMemberAssignmentsForBindingName(resultStatements, element.name);
652652
}
653653
}
654654
else {

src/compiler/transformers/module/system.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ namespace ts {
1212
const {
1313
getNodeEmitFlags,
1414
setNodeEmitFlags,
15-
getCommentRange,
16-
setCommentRange,
17-
getSourceMapRange,
18-
setSourceMapRange,
1915
startLexicalEnvironment,
2016
endLexicalEnvironment,
2117
hoistVariableDeclaration,

src/compiler/transformers/ts.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,19 +2974,6 @@ namespace ts {
29742974
}
29752975
}
29762976

2977-
function getDeclarationNameExpression(node: DeclarationStatement) {
2978-
const name = getDeclarationName(node);
2979-
if (isNamespaceExport(node)) {
2980-
return getNamespaceMemberName(name);
2981-
}
2982-
else {
2983-
// We set the "ExportName" flag to indicate to any module transformer
2984-
// downstream that any `exports.` prefix should be added.
2985-
setNodeEmitFlags(name, getNodeEmitFlags(name) | NodeEmitFlags.ExportName);
2986-
return name;
2987-
}
2988-
}
2989-
29902977
function getClassPrototype(node: ClassExpression | ClassDeclaration) {
29912978
return createPropertyAccess(getDeclarationName(node), "prototype");
29922979
}
@@ -3090,7 +3077,7 @@ namespace ts {
30903077
currentDecoratedClassAliases[getOriginalNodeId(node)] = decoratedClassAliases[getOriginalNodeId(node)];
30913078
}
30923079
else if (node.kind === SyntaxKind.Identifier) {
3093-
const declaration = resolver.getReferencedValueDeclaration(<Identifier>node)
3080+
const declaration = resolver.getReferencedValueDeclaration(<Identifier>node);
30943081
if (declaration && isClassWithDecorators(declaration)) {
30953082
currentDecoratedClassAliases[getOriginalNodeId(declaration)] = decoratedClassAliases[getOriginalNodeId(declaration)];
30963083
}

0 commit comments

Comments
 (0)