Fix various linter warnings.
This commit is contained in:
parent
08bd78e498
commit
5fbb326d8d
9 changed files with 19 additions and 50 deletions
|
@ -296,7 +296,7 @@ namespace ts {
|
|||
},
|
||||
emitTrailingComments(range: TextRange, comments: CommentRange[]): void {
|
||||
const commentStart = performance.mark();
|
||||
emitLeadingComments(range, comments);
|
||||
emitTrailingComments(range, comments);
|
||||
performance.measure("commentTime", commentStart);
|
||||
},
|
||||
emitLeadingDetachedComments(range: TextRange, contextNode?: Node, ignoreNodeCallback?: (contextNode: Node) => boolean): void {
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
/* @internal */
|
||||
namespace ts {
|
||||
const synthesizedLocation: TextRange = { pos: -1, end: -1 };
|
||||
|
||||
let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
let SourceFileConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
|
||||
|
||||
|
@ -151,7 +149,8 @@ namespace ts {
|
|||
name.text = "";
|
||||
name.originalKeywordKind = SyntaxKind.Unknown;
|
||||
name.autoGenerateKind = GeneratedIdentifierKind.Auto;
|
||||
name.autoGenerateId = nextAutoGenerateId++;
|
||||
name.autoGenerateId = nextAutoGenerateId;
|
||||
nextAutoGenerateId++;
|
||||
if (recordTempVariable) {
|
||||
recordTempVariable(name);
|
||||
}
|
||||
|
@ -163,7 +162,8 @@ namespace ts {
|
|||
name.text = "";
|
||||
name.originalKeywordKind = SyntaxKind.Unknown;
|
||||
name.autoGenerateKind = GeneratedIdentifierKind.Loop;
|
||||
name.autoGenerateId = nextAutoGenerateId++;
|
||||
name.autoGenerateId = nextAutoGenerateId;
|
||||
nextAutoGenerateId++;
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,8 @@ namespace ts {
|
|||
name.text = text;
|
||||
name.originalKeywordKind = SyntaxKind.Unknown;
|
||||
name.autoGenerateKind = GeneratedIdentifierKind.Unique;
|
||||
name.autoGenerateId = nextAutoGenerateId++;
|
||||
name.autoGenerateId = nextAutoGenerateId;
|
||||
nextAutoGenerateId++;
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@ -182,7 +183,8 @@ namespace ts {
|
|||
name.text = "";
|
||||
name.originalKeywordKind = SyntaxKind.Unknown;
|
||||
name.autoGenerateKind = GeneratedIdentifierKind.Node;
|
||||
name.autoGenerateId = nextAutoGenerateId++;
|
||||
name.autoGenerateId = nextAutoGenerateId;
|
||||
nextAutoGenerateId++;
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
|
@ -508,10 +508,6 @@ namespace ts {
|
|||
return skipTrivia(currentSourceText, rangeHasDecorators ? (range as Node).decorators.end : range.pos);
|
||||
}
|
||||
|
||||
function getStartPos(range: TextRange) {
|
||||
return skipTrivia(currentSourceText, range.pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits a mapping for the start of a range.
|
||||
*
|
||||
|
|
|
@ -156,7 +156,9 @@ namespace ts {
|
|||
* @param transforms An array of Transformers.
|
||||
*/
|
||||
export function transformFiles(resolver: EmitResolver, host: EmitHost, sourceFiles: SourceFile[], transformers: Transformer[]) {
|
||||
const transformId = nextTransformId++;
|
||||
const transformId = nextTransformId;
|
||||
nextTransformId++;
|
||||
|
||||
const tokenSourceMapRanges: Map<TextRange> = { };
|
||||
const lexicalEnvironmentVariableDeclarationsStack: VariableDeclaration[][] = [];
|
||||
const lexicalEnvironmentFunctionDeclarationsStack: FunctionDeclaration[][] = [];
|
||||
|
|
|
@ -2918,20 +2918,6 @@ namespace ts {
|
|||
return getDeclarationName(node, allowComments, allowSourceMaps, NodeEmitFlags.LocalName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the export name for a declaration for use in expressions.
|
||||
*
|
||||
* An export name will *always* be prefixed with an module or namespace export modifier
|
||||
* like "exports." if one is required.
|
||||
*
|
||||
* @param node The declaration.
|
||||
* @param allowComments A value indicating whether comments may be emitted for the name.
|
||||
* @param allowSourceMaps A value indicating whether source maps may be emitted for the name.
|
||||
*/
|
||||
function getExportName(node: ClassDeclaration | ClassExpression | FunctionDeclaration, allowComments?: boolean, allowSourceMaps?: boolean) {
|
||||
return getDeclarationName(node, allowComments, allowSourceMaps, NodeEmitFlags.ExportName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of a declaration, without source map or comments.
|
||||
*
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace ts {
|
|||
return undefined; // do not emit export equals for ES6
|
||||
}
|
||||
const original = getOriginalNode(node);
|
||||
return nodeIsSynthesized(original) || resolver.isValueAliasDeclaration(original) ? node: undefined;
|
||||
return nodeIsSynthesized(original) || resolver.isValueAliasDeclaration(original) ? node : undefined;
|
||||
}
|
||||
|
||||
function visitExportDeclaration(node: ExportDeclaration): ExportDeclaration {
|
||||
|
@ -64,7 +64,7 @@ namespace ts {
|
|||
if (node.exportClause === newExportClause) {
|
||||
return node;
|
||||
}
|
||||
return newExportClause
|
||||
return newExportClause
|
||||
? createExportDeclaration(newExportClause, node.moduleSpecifier)
|
||||
: undefined;
|
||||
}
|
||||
|
@ -106,12 +106,12 @@ namespace ts {
|
|||
const newNamedBindings = visitNode(node.namedBindings, visitor, isNamedImportBindings, /*optional*/ true);
|
||||
return newDefaultImport !== node.name || newNamedBindings !== node.namedBindings
|
||||
? createImportClause(newDefaultImport, newNamedBindings)
|
||||
: node;
|
||||
: node;
|
||||
}
|
||||
|
||||
function visitNamedBindings(node: NamedImportBindings): VisitResult<NamedImportBindings> {
|
||||
if (node.kind === SyntaxKind.NamespaceImport) {
|
||||
return resolver.isReferencedAliasDeclaration(node) ? node: undefined;
|
||||
return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
|
||||
}
|
||||
else {
|
||||
const newNamedImportElements = visitNodes((<NamedImports>node).elements, visitor, isImportSpecifier);
|
||||
|
|
|
@ -619,7 +619,7 @@ namespace ts {
|
|||
if (hasModifier(node, ModifierFlags.Export)) {
|
||||
const variables = getInitializedVariables(node.declarationList);
|
||||
if (variables.length > 0) {
|
||||
let inlineAssignments = createStatement(
|
||||
const inlineAssignments = createStatement(
|
||||
inlineExpressions(
|
||||
map(variables, transformInitializedVariable)
|
||||
),
|
||||
|
@ -648,7 +648,7 @@ namespace ts {
|
|||
function addExportMemberAssignmentsForBindingName(resultStatements: Statement[], name: BindingName): void {
|
||||
if (isBindingPattern(name)) {
|
||||
for (const element of name.elements) {
|
||||
addExportMemberAssignmentsForBindingName(resultStatements, element.name)
|
||||
addExportMemberAssignmentsForBindingName(resultStatements, element.name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -12,10 +12,6 @@ namespace ts {
|
|||
const {
|
||||
getNodeEmitFlags,
|
||||
setNodeEmitFlags,
|
||||
getCommentRange,
|
||||
setCommentRange,
|
||||
getSourceMapRange,
|
||||
setSourceMapRange,
|
||||
startLexicalEnvironment,
|
||||
endLexicalEnvironment,
|
||||
hoistVariableDeclaration,
|
||||
|
|
|
@ -2974,19 +2974,6 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
function getDeclarationNameExpression(node: DeclarationStatement) {
|
||||
const name = getDeclarationName(node);
|
||||
if (isNamespaceExport(node)) {
|
||||
return getNamespaceMemberName(name);
|
||||
}
|
||||
else {
|
||||
// We set the "ExportName" flag to indicate to any module transformer
|
||||
// downstream that any `exports.` prefix should be added.
|
||||
setNodeEmitFlags(name, getNodeEmitFlags(name) | NodeEmitFlags.ExportName);
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
function getClassPrototype(node: ClassExpression | ClassDeclaration) {
|
||||
return createPropertyAccess(getDeclarationName(node), "prototype");
|
||||
}
|
||||
|
@ -3090,7 +3077,7 @@ namespace ts {
|
|||
currentDecoratedClassAliases[getOriginalNodeId(node)] = decoratedClassAliases[getOriginalNodeId(node)];
|
||||
}
|
||||
else if (node.kind === SyntaxKind.Identifier) {
|
||||
const declaration = resolver.getReferencedValueDeclaration(<Identifier>node)
|
||||
const declaration = resolver.getReferencedValueDeclaration(<Identifier>node);
|
||||
if (declaration && isClassWithDecorators(declaration)) {
|
||||
currentDecoratedClassAliases[getOriginalNodeId(declaration)] = decoratedClassAliases[getOriginalNodeId(declaration)];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue