From d4403df35e80570c4764fe64981d8dc78bc68011 Mon Sep 17 00:00:00 2001 From: Dan Quirk Date: Thu, 25 Jun 2015 17:36:19 -0700 Subject: [PATCH] var -> let --- src/compiler/binder.ts | 4 +- src/compiler/checker.ts | 52 +++++++++++++------------- src/compiler/commandLineParser.ts | 62 +++++++++++++++---------------- src/compiler/emitter.ts | 28 +++++++------- src/compiler/parser.ts | 12 +++--- src/compiler/program.ts | 10 ++--- src/compiler/tsc.ts | 2 +- src/compiler/utilities.ts | 4 +- 8 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 9542f711753..c4e93d359d1 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -474,7 +474,7 @@ namespace ts { } function hasExportDeclarations(node: ModuleDeclaration | SourceFile): boolean { - var body = node.kind === SyntaxKind.SourceFile ? node : (node).body; + let body = node.kind === SyntaxKind.SourceFile ? node : (node).body; if (body.kind === SyntaxKind.SourceFile || body.kind === SyntaxKind.ModuleBlock) { for (let stat of (body).statements) { if (stat.kind === SyntaxKind.ExportDeclaration || stat.kind === SyntaxKind.ExportAssignment) { @@ -750,7 +750,7 @@ namespace ts { function bind(node: Node) { node.parent = parent; - var savedInStrictMode = inStrictMode; + let savedInStrictMode = inStrictMode; if (!savedInStrictMode) { updateStrictMode(node); } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0367aa8292f..62b4cfb4d55 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -282,7 +282,7 @@ namespace ts { function getSymbolLinks(symbol: Symbol): SymbolLinks { if (symbol.flags & SymbolFlags.Transient) return symbol; - var id = getSymbolId(symbol); + let id = getSymbolId(symbol); return symbolLinks[id] || (symbolLinks[id] = {}); } @@ -630,7 +630,7 @@ namespace ts { } function getTargetOfNamespaceImport(node: NamespaceImport): Symbol { - var moduleSpecifier = (node.parent.parent).moduleSpecifier; + let moduleSpecifier = (node.parent.parent).moduleSpecifier; return resolveESModuleSymbol(resolveExternalModuleName(node, moduleSpecifier), moduleSpecifier); } @@ -685,7 +685,7 @@ namespace ts { function getPropertyOfVariable(symbol: Symbol, name: string): Symbol { if (symbol.flags & SymbolFlags.Variable) { - var typeAnnotation = (symbol.valueDeclaration).type; + let typeAnnotation = (symbol.valueDeclaration).type; if (typeAnnotation) { return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); } @@ -1305,7 +1305,7 @@ namespace ts { // Mark the unexported alias as visible if its parent is visible // because these kind of aliases can be used to name types in declaration file - var anyImportSyntax = getAnyImportSyntax(declaration); + let anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && !(anyImportSyntax.flags & NodeFlags.Export) && // import clause without export isDeclarationVisible(anyImportSyntax.parent)) { @@ -2086,14 +2086,14 @@ namespace ts { } function collectLinkedAliases(node: Identifier): Node[] { - var exportSymbol: Symbol; + let exportSymbol: Symbol; if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) { exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, node); } else if (node.parent.kind === SyntaxKind.ExportSpecifier) { exportSymbol = getTargetOfExportSpecifier(node.parent); } - var result: Node[] = []; + let result: Node[] = []; if (exportSymbol) { buildVisibleNodeList(exportSymbol.declarations); } @@ -2102,16 +2102,16 @@ namespace ts { function buildVisibleNodeList(declarations: Declaration[]) { forEach(declarations, declaration => { getNodeLinks(declaration).isVisible = true; - var resultNode = getAnyImportSyntax(declaration) || declaration; + let resultNode = getAnyImportSyntax(declaration) || declaration; if (!contains(result, resultNode)) { result.push(resultNode); } if (isInternalModuleImportEqualsDeclaration(declaration)) { // Add the referenced top container visible - var internalModuleReference = (declaration).moduleReference; - var firstIdentifier = getFirstIdentifier(internalModuleReference); - var importSymbol = resolveName(declaration, firstIdentifier.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, + let internalModuleReference = (declaration).moduleReference; + let firstIdentifier = getFirstIdentifier(internalModuleReference); + let importSymbol = resolveName(declaration, firstIdentifier.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, firstIdentifier); buildVisibleNodeList(importSymbol.declarations); } @@ -2606,7 +2606,7 @@ namespace ts { // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol: Symbol): TypeParameter[] { - var declaration = symbol.flags & SymbolFlags.Class ? symbol.valueDeclaration : getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration); + let declaration = symbol.flags & SymbolFlags.Class ? symbol.valueDeclaration : getDeclarationOfKind(symbol, SyntaxKind.InterfaceDeclaration); return appendOuterTypeParameters(undefined, declaration); } @@ -9908,7 +9908,7 @@ namespace ts { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { case SyntaxKind.ClassDeclaration: - var constructor = getFirstConstructorWithBody(node); + let constructor = getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } @@ -10159,7 +10159,7 @@ namespace ts { return; } - var symbol = getSymbolOfNode(node); + let symbol = getSymbolOfNode(node); if (symbol.flags & SymbolFlags.FunctionScopedVariable) { let localDeclarationSymbol = resolveName(node, (node.name).text, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); if (localDeclarationSymbol && @@ -11404,7 +11404,7 @@ namespace ts { } // expression part in ElementAccess\PropertyAccess should be either identifier or dottedName - var current = expression; + let current = expression; while (current) { if (current.kind === SyntaxKind.Identifier) { break; @@ -12614,7 +12614,7 @@ namespace ts { return false; } - var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); + let isValue = isAliasResolvedToValue(getSymbolOfNode(node)); return isValue && node.moduleReference && !nodeIsMissing(node.moduleReference); } @@ -12698,7 +12698,7 @@ namespace ts { // here has no effect anyway as an identifier in a type name is not an expression. // var substitution = getExpressionNameSubstitution(node, getGeneratedNameForNode); // var text = substitution || (node).text; - var text = (node).text; + let text = (node).text; if (fallbackPath) { fallbackPath.push(text); } @@ -12707,8 +12707,8 @@ namespace ts { } } else { - var left = serializeEntityName((node).left, fallbackPath); - var right = serializeEntityName((node).right, fallbackPath); + let left = serializeEntityName((node).left, fallbackPath); + let right = serializeEntityName((node).right, fallbackPath); if (!fallbackPath) { return left + "." + right; } @@ -12748,7 +12748,7 @@ namespace ts { return "Symbol"; } else if (type === unknownType) { - var fallbackPath: string[] = []; + let fallbackPath: string[] = []; serializeEntityName(node.typeName, fallbackPath); return fallbackPath; } @@ -12843,7 +12843,7 @@ namespace ts { // // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. if (node) { - var valueDeclaration: FunctionLikeDeclaration; + let valueDeclaration: FunctionLikeDeclaration; if (node.kind === SyntaxKind.ClassDeclaration) { valueDeclaration = getFirstConstructorWithBody(node); } @@ -12851,14 +12851,14 @@ namespace ts { valueDeclaration = node; } if (valueDeclaration) { - var result: (string | string[])[]; - var parameters = valueDeclaration.parameters; - var parameterCount = parameters.length; + let result: (string | string[])[]; + let parameters = valueDeclaration.parameters; + let parameterCount = parameters.length; if (parameterCount > 0) { result = new Array(parameterCount); - for (var i = 0; i < parameterCount; i++) { + for (let i = 0; i < parameterCount; i++) { if (parameters[i].dotDotDotToken) { - var parameterType = parameters[i].type; + let parameterType = parameters[i].type; if (parameterType.kind === SyntaxKind.ArrayType) { parameterType = (parameterType).elementType; } @@ -12905,7 +12905,7 @@ namespace ts { } function writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter) { - var type = getTypeOfExpression(expr); + let type = getTypeOfExpression(expr); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 4e401c5c9b3..8bdbdfaa8c9 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -5,7 +5,7 @@ namespace ts { /* @internal */ - export var optionDeclarations: CommandLineOption[] = [ + export let optionDeclarations: CommandLineOption[] = [ { name: "charset", type: "string", @@ -207,11 +207,11 @@ namespace ts { ]; export function parseCommandLine(commandLine: string[]): ParsedCommandLine { - var options: CompilerOptions = {}; - var fileNames: string[] = []; - var errors: Diagnostic[] = []; - var shortOptionNames: Map = {}; - var optionNameMap: Map = {}; + let options: CompilerOptions = {}; + let fileNames: string[] = []; + let errors: Diagnostic[] = []; + let shortOptionNames: Map = {}; + let optionNameMap: Map = {}; forEach(optionDeclarations, option => { optionNameMap[option.name.toLowerCase()] = option; @@ -227,9 +227,9 @@ namespace ts { }; function parseStrings(args: string[]) { - var i = 0; + let i = 0; while (i < args.length) { - var s = args[i++]; + let s = args[i++]; if (s.charCodeAt(0) === CharacterCodes.at) { parseResponseFile(s.slice(1)); } @@ -242,7 +242,7 @@ namespace ts { } if (hasProperty(optionNameMap, s)) { - var opt = optionNameMap[s]; + let opt = optionNameMap[s]; // Check to see if no argument was provided (e.g. "--locale" is the last command-line argument). if (!args[i] && opt.type !== "boolean") { @@ -261,8 +261,8 @@ namespace ts { break; // If not a primitive, the possible types are specified in what is effectively a map of options. default: - var map = >opt.type; - var key = (args[i++] || "").toLowerCase(); + let map = >opt.type; + let key = (args[i++] || "").toLowerCase(); if (hasProperty(map, key)) { options[opt.name] = map[key]; } @@ -282,19 +282,19 @@ namespace ts { } function parseResponseFile(fileName: string) { - var text = sys.readFile(fileName); + let text = sys.readFile(fileName); if (!text) { errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, fileName)); return; } - var args: string[] = []; - var pos = 0; + let args: string[] = []; + let pos = 0; while (true) { while (pos < text.length && text.charCodeAt(pos) <= CharacterCodes.space) pos++; if (pos >= text.length) break; - var start = pos; + let start = pos; if (text.charCodeAt(start) === CharacterCodes.doubleQuote) { pos++; while (pos < text.length && text.charCodeAt(pos) !== CharacterCodes.doubleQuote) pos++; @@ -321,7 +321,7 @@ namespace ts { */ export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } { try { - var text = sys.readFile(fileName); + let text = sys.readFile(fileName); } catch (e) { return { error: createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; @@ -350,7 +350,7 @@ namespace ts { * file to. e.g. outDir */ export function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine { - var errors: Diagnostic[] = []; + let errors: Diagnostic[] = []; return { options: getCompilerOptions(), @@ -359,22 +359,22 @@ namespace ts { }; function getCompilerOptions(): CompilerOptions { - var options: CompilerOptions = {}; - var optionNameMap: Map = {}; + let options: CompilerOptions = {}; + let optionNameMap: Map = {}; forEach(optionDeclarations, option => { optionNameMap[option.name] = option; }); - var jsonOptions = json["compilerOptions"]; + let jsonOptions = json["compilerOptions"]; if (jsonOptions) { - for (var id in jsonOptions) { + for (let id in jsonOptions) { if (hasProperty(optionNameMap, id)) { - var opt = optionNameMap[id]; - var optType = opt.type; - var value = jsonOptions[id]; - var expectedType = typeof optType === "string" ? optType : "string"; + let opt = optionNameMap[id]; + let optType = opt.type; + let value = jsonOptions[id]; + let expectedType = typeof optType === "string" ? optType : "string"; if (typeof value === expectedType) { if (typeof optType !== "string") { - var key = value.toLowerCase(); + let key = value.toLowerCase(); if (hasProperty(optType, key)) { value = optType[key]; } @@ -401,17 +401,17 @@ namespace ts { } function getFileNames(): string[] { - var fileNames: string[] = []; + let fileNames: string[] = []; if (hasProperty(json, "files")) { if (json["files"] instanceof Array) { fileNames = map(json["files"], s => combinePaths(basePath, s)); } } else { - var exclude = json["exclude"] instanceof Array ? map(json["exclude"], normalizeSlashes) : undefined; - var sysFiles = host.readDirectory(basePath, ".ts", exclude); - for (var i = 0; i < sysFiles.length; i++) { - var name = sysFiles[i]; + let exclude = json["exclude"] instanceof Array ? map(json["exclude"], normalizeSlashes) : undefined; + let sysFiles = host.readDirectory(basePath, ".ts", exclude); + for (let i = 0; i < sysFiles.length; i++) { + let name = sysFiles[i]; if (!fileExtensionIs(name, ".d.ts") || !contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) { fileNames.push(name); } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 1a31cab2ede..e71d3aea41b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -209,7 +209,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { // Note that names generated by makeTempVariableName and makeUniqueName will never conflict. function makeTempVariableName(flags: TempFlags): string { if (flags && !(tempFlags & flags)) { - var name = flags === TempFlags._i ? "_i" : "_n"; + let name = flags === TempFlags._i ? "_i" : "_n"; if (isUniqueName(name)) { tempFlags |= flags; return name; @@ -1309,7 +1309,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { write("super"); } else { - var flags = resolver.getNodeCheckFlags(node); + let flags = resolver.getNodeCheckFlags(node); if (flags & NodeCheckFlags.SuperInstance) { write("_super.prototype"); } @@ -1456,7 +1456,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { write("{"); if (numElements > 0) { - var properties = node.properties; + let properties = node.properties; // If we are not doing a downlevel transformation for object literals, // then try to preserve the original shape of the object literal. @@ -2685,7 +2685,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { function emitModuleMemberName(node: Declaration) { emitStart(node.name); if (getCombinedNodeFlags(node) & NodeFlags.Export) { - var container = getContainingModule(node); + let container = getContainingModule(node); if (container) { write(getGeneratedNameForNode(container)); write("."); @@ -3783,7 +3783,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeElement) { - var superCall = findInitialSuperCall(ctor); + let superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); emit(superCall); @@ -3806,7 +3806,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { } emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false)); if (ctor) { - var statements: Node[] = (ctor.body).statements; + let statements: Node[] = (ctor.body).statements; if (superCall) { statements = statements.slice(1); } @@ -3946,7 +3946,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { emitDeclarationName(node); } - var baseTypeNode = getClassExtendsHeritageClauseElement(node); + let baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { write(" extends "); emit(baseTypeNode.expression); @@ -4353,7 +4353,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { let argumentsWritten = 0; if (compilerOptions.emitDecoratorMetadata) { if (shouldEmitTypeMetadata(node)) { - var serializedType = resolver.serializeTypeOfNode(node); + let serializedType = resolver.serializeTypeOfNode(node); if (serializedType) { if (writeComma) { write(", "); @@ -4366,7 +4366,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { } } if (shouldEmitParamTypesMetadata(node)) { - var serializedTypes = resolver.serializeParameterTypesOfNode(node); + let serializedTypes = resolver.serializeParameterTypesOfNode(node); if (serializedTypes) { if (writeComma || argumentsWritten) { write(", "); @@ -4384,7 +4384,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { } } if (shouldEmitReturnTypeMetadata(node)) { - var serializedType = resolver.serializeReturnTypeOfNode(node); + let serializedType = resolver.serializeReturnTypeOfNode(node); if (serializedType) { if (writeComma || argumentsWritten) { write(", "); @@ -4885,7 +4885,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { writeLine(); emitStart(node); write("export default "); - var expression = node.expression; + let expression = node.expression; emit(expression); if (expression.kind !== SyntaxKind.FunctionDeclaration && expression.kind !== SyntaxKind.ClassDeclaration) { @@ -5370,7 +5370,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { // } emitVariableDeclarationsForImports(); writeLine(); - var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + let exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); let exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); writeLine(); write("return {"); @@ -5725,7 +5725,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { emitDetachedComments(node); // emit prologue directives prior to __extends - var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); + let startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); // Only emit helpers if the user did not say otherwise. if (!compilerOptions.noEmitHelpers) { @@ -6081,7 +6081,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) { function emitTrailingComments(node: Node) { // Emit the trailing comments only if the parent's end doesn't match - var trailingComments = filterComments(getTrailingCommentsToEmit(node), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + let trailingComments = filterComments(getTrailingCommentsToEmit(node), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ef61b77ba12..8e062c647fa 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2709,7 +2709,7 @@ namespace ts { // If we have an arrow, then try to parse the body. Even if not, try to parse if we // have an opening brace, just in case we're in an error state. - var lastToken = token; + let lastToken = token; arrowFunction.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, /*reportAtCurrentPosition*/false, Diagnostics._0_expected, "=>"); arrowFunction.body = (lastToken === SyntaxKind.EqualsGreaterThanToken || lastToken === SyntaxKind.OpenBraceToken) ? parseArrowFunctionExpressionBody() @@ -4421,7 +4421,7 @@ namespace ts { } function parseClassDeclarationOrExpression(fullStart: number, decorators: NodeArray, modifiers: ModifiersArray, kind: SyntaxKind): ClassLikeDeclaration { - var node = createNode(kind, fullStart); + let node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(SyntaxKind.ClassKeyword); @@ -4957,15 +4957,15 @@ namespace ts { } function parseJSDocTopLevelType(): JSDocType { - var type = parseJSDocType(); + let type = parseJSDocType(); if (token === SyntaxKind.BarToken) { - var unionType = createNode(SyntaxKind.JSDocUnionType, type.pos); + let unionType = createNode(SyntaxKind.JSDocUnionType, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } if (token === SyntaxKind.EqualsToken) { - var optionalType = createNode(SyntaxKind.JSDocOptionalType, type.pos); + let optionalType = createNode(SyntaxKind.JSDocOptionalType, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -5648,7 +5648,7 @@ namespace ts { function visitNode(node: IncrementalNode) { if (aggressiveChecks && shouldCheckNode(node)) { - var text = oldText.substring(node.pos, node.end); + let text = oldText.substring(node.pos, node.end); } // Ditch any existing LS children we may have created. This way we can avoid diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 501981e4ddf..c780b8709ba 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -11,12 +11,12 @@ namespace ts { export const version = "1.5.3"; export function findConfigFile(searchPath: string): string { - var fileName = "tsconfig.json"; + let fileName = "tsconfig.json"; while (true) { if (sys.fileExists(fileName)) { return fileName; } - var parentPath = getDirectoryPath(searchPath); + let parentPath = getDirectoryPath(searchPath); if (parentPath === searchPath) { break; } @@ -79,7 +79,7 @@ namespace ts { function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) { try { - var start = new Date().getTime(); + let start = new Date().getTime(); ensureDirectoriesExist(getDirectoryPath(normalizePath(fileName))); sys.writeFile(fileName, data, writeByteOrderMark); ioWriteTime += new Date().getTime() - start; @@ -309,7 +309,7 @@ namespace ts { if (!isDeclarationFile(sourceFile)) { let resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); // Don't actually write any files since we're just getting diagnostics. - var writeFile: WriteFileCallback = () => { }; + let writeFile: WriteFileCallback = () => { }; return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); } } @@ -358,7 +358,7 @@ namespace ts { } } else { - var nonTsFile: SourceFile = options.allowNonTsExtensions && findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd); + let nonTsFile: SourceFile = options.allowNonTsExtensions && findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd); if (!nonTsFile) { if (options.allowNonTsExtensions) { diagnostic = Diagnostics.File_0_not_found; diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 2903c3a31f4..017b5679d4b 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -82,7 +82,7 @@ namespace ts { function reportDiagnostic(diagnostic: Diagnostic) { var output = ""; - + if (diagnostic.file) { var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index bdc04a6b1ee..bd785c7a817 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1409,7 +1409,7 @@ namespace ts { } export function createSynthesizedNodeArray(): NodeArray { - var array = >[]; + let array = >[]; array.pos = -1; array.end = -1; return array; @@ -1994,7 +1994,7 @@ namespace ts { * Converts a string to a base-64 encoded ASCII string. */ export function convertToBase64(input: string): string { - var result = ""; + let result = ""; let charCodes = getExpandedCharCodes(input); let i = 0; let length = charCodes.length;