diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index fe52e26ddd14a..c97e1f3477261 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -471,7 +471,7 @@ module ts { break; case SyntaxKind.SourceFile: if (isExternalModule(node)) { - bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + removeFileExtension((node).filename) + '"', /*isBlockScopeContainer*/ true); + bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + removeFileExtension((node).fileName) + '"', /*isBlockScopeContainer*/ true); break; } case SyntaxKind.Block: diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f44c9b118f83b..6aa4862abc577 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -538,7 +538,7 @@ module ts { } var moduleReferenceLiteral = moduleReferenceExpression; - var searchPath = getDirectoryPath(getSourceFile(location).filename); + var searchPath = getDirectoryPath(getSourceFile(location).fileName); // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. @@ -553,8 +553,8 @@ module ts { } } while (true) { - var filename = normalizePath(combinePaths(searchPath, moduleName)); - var sourceFile = host.getSourceFile(filename + ".ts") || host.getSourceFile(filename + ".d.ts"); + var fileName = normalizePath(combinePaths(searchPath, moduleName)); + var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); if (sourceFile || isRelative) break; var parentPath = getDirectoryPath(searchPath); if (parentPath === searchPath) break; @@ -564,7 +564,7 @@ module ts { if (sourceFile.symbol) { return getResolvedExportSymbol(sourceFile.symbol); } - error(moduleReferenceLiteral, Diagnostics.File_0_is_not_an_external_module, sourceFile.filename); + error(moduleReferenceLiteral, Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName); return; } error(moduleReferenceLiteral, Diagnostics.Cannot_find_external_module_0, moduleName); diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index a46f91686448e..4ba2da757e5d8 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -164,7 +164,7 @@ module ts { export function parseCommandLine(commandLine: string[]): ParsedCommandLine { var options: CompilerOptions = {}; - var filenames: string[] = []; + var fileNames: string[] = []; var errors: Diagnostic[] = []; var shortOptionNames: Map = {}; var optionNameMap: Map = {}; @@ -178,7 +178,7 @@ module ts { parseStrings(commandLine); return { options, - filenames, + fileNames, errors }; @@ -232,16 +232,16 @@ module ts { } } else { - filenames.push(s); + fileNames.push(s); } } } - function parseResponseFile(filename: string) { - var text = sys.readFile(filename); + function parseResponseFile(fileName: string) { + var text = sys.readFile(fileName); if (!text) { - errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, filename)); + errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, fileName)); return; } @@ -259,7 +259,7 @@ module ts { pos++; } else { - errors.push(createCompilerDiagnostic(Diagnostics.Unterminated_quoted_string_in_response_file_0, filename)); + errors.push(createCompilerDiagnostic(Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)); } } else { @@ -271,9 +271,9 @@ module ts { } } - export function readConfigFile(filename: string): any { + export function readConfigFile(fileName: string): any { try { - var text = sys.readFile(filename); + var text = sys.readFile(fileName); return /\S/.test(text) ? JSON.parse(text) : {}; } catch (e) { @@ -285,7 +285,7 @@ module ts { return { options: getCompilerOptions(), - filenames: getFiles(), + fileNames: getFiles(), errors }; diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 894f0eadd1661..87094150bafbd 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -364,12 +364,12 @@ module ts { return a < b ? Comparison.LessThan : Comparison.GreaterThan; } - function getDiagnosticFilename(diagnostic: Diagnostic): string { - return diagnostic.file ? diagnostic.file.filename : undefined; + function getDiagnosticFileName(diagnostic: Diagnostic): string { + return diagnostic.file ? diagnostic.file.fileName : undefined; } export function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): number { - return compareValues(getDiagnosticFilename(d1), getDiagnosticFilename(d2)) || + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || @@ -472,8 +472,8 @@ module ts { return normalizedPathComponents(path, rootLength); } - export function getNormalizedAbsolutePath(filename: string, currentDirectory: string) { - return getNormalizedPathFromPathComponents(getNormalizedPathComponents(filename, currentDirectory)); + export function getNormalizedAbsolutePath(fileName: string, currentDirectory: string) { + return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory)); } export function getNormalizedPathFromPathComponents(pathComponents: string[]) { @@ -571,7 +571,7 @@ module ts { return absolutePath; } - export function getBaseFilename(path: string) { + export function getBaseFileName(path: string) { var i = path.lastIndexOf(directorySeparator); return i < 0 ? path : path.substring(i + 1); } @@ -644,7 +644,7 @@ module ts { } } - export function getDefaultLibFilename(options: CompilerOptions): string { + export function getDefaultLibFileName(options: CompilerOptions): string { return options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts"; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 4b10b50e31efe..7bf95dcc84670 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -109,7 +109,7 @@ module ts { Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." }, Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module." }, Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." }, - Filename_0_differs_from_already_included_filename_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "Filename '{0}' differs from already included filename '{1}' only in casing" }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, var_let_or_const_expected: { code: 1152, category: DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." }, let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: DiagnosticCategory.Error, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 456c97a7c776b..b4944f56d774a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -427,7 +427,7 @@ "category": "Error", "code": 1148 }, - "Filename '{0}' differs from already included filename '{1}' only in casing": { + "File name '{0}' differs from already included file name '{1}' only in casing": { "category": "Error", "code": 1149 }, diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 086a402efb2cd..a4521977802e1 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -55,7 +55,7 @@ module ts { export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean { if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.filename, ".js")) { + if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.fileName, ".js")) { return true; } return false; @@ -314,7 +314,7 @@ module ts { } function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string) { - var sourceFilePath = getNormalizedAbsolutePath(sourceFile.filename, host.getCurrentDirectory()); + var sourceFilePath = getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), ""); return combinePaths(newDirPath, sourceFilePath); } @@ -325,15 +325,15 @@ module ts { var emitOutputFilePathWithoutExtension = removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); } else { - var emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.filename); + var emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.fileName); } return emitOutputFilePathWithoutExtension + extension; } - function writeFile(host: EmitHost, diagnostics: Diagnostic[], filename: string, data: string, writeByteOrderMark: boolean) { - host.writeFile(filename, data, writeByteOrderMark, hostErrorMessage => { - diagnostics.push(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, filename, hostErrorMessage)); + function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean) { + host.writeFile(fileName, data, writeByteOrderMark, hostErrorMessage => { + diagnostics.push(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); }); } @@ -1481,7 +1481,7 @@ module ts { function writeReferencePath(referencedFile: SourceFile) { var declFileName = referencedFile.flags & NodeFlags.DeclarationFile - ? referencedFile.filename // Declaration file, use declaration file name + ? referencedFile.fileName // Declaration file, use declaration file name : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file : removeFileExtension(compilerOptions.out) + ".d.ts";// Global out file @@ -1735,14 +1735,14 @@ module ts { var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; sourceMapData.sourceMapSources.push(getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, - node.filename, + node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, /*isAbsolutePathAnUrl*/ true)); sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; // The one that can be used from program to get the actual source file - sourceMapData.inputSourceFileNames.push(node.filename); + sourceMapData.inputSourceFileNames.push(node.fileName); } function recordScopeNameOfNode(node: Node, scopeName?: string) { @@ -1857,7 +1857,7 @@ module ts { } // Initialize source map data - var sourceMapJsFile = getBaseFilename(normalizeSlashes(jsFilePath)); + var sourceMapJsFile = getBaseFileName(normalizeSlashes(jsFilePath)); sourceMapData = { sourceMapFilePath: jsFilePath + ".map", jsSourceMappingURL: sourceMapJsFile + ".map", diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9ad9067d6fae7..866d66d515166 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -667,7 +667,7 @@ module ts { if (sourceFile.statements.length === 0) { // If we don't have any statements in the current source file, then there's no real // way to incrementally parse. So just do a full parse instead. - return parseSourceFile(sourceFile.filename, newText, sourceFile.languageVersion,/*syntaxCursor*/ undefined, /*setNodeParents*/ true) + return parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion,/*syntaxCursor*/ undefined, /*setNodeParents*/ true) } var syntaxCursor = createSyntaxCursor(sourceFile); @@ -713,7 +713,7 @@ module ts { // inconsistent tree. Setting the parents on the new tree should be very fast. We // will immediately bail out of walking any subtrees when we can see that their parents // are already correct. - var result = parseSourceFile(sourceFile.filename, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true) + var result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true) return result; } @@ -857,11 +857,11 @@ module ts { } } } - export function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false): SourceFile { - return parseSourceFile(filename, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes); + export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false): SourceFile { + return parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes); } - function parseSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: SyntaxCursor, setParentNodes = false): SourceFile { + function parseSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: SyntaxCursor, setParentNodes = false): SourceFile { var parsingContext: ParsingContext = 0; var identifiers: Map = {}; var identifierCount = 0; @@ -876,8 +876,8 @@ module ts { sourceFile.parseDiagnostics = []; sourceFile.semanticDiagnostics = []; sourceFile.languageVersion = languageVersion; - sourceFile.filename = normalizePath(filename); - sourceFile.flags = fileExtensionIs(sourceFile.filename, ".d.ts") ? NodeFlags.DeclarationFile : 0; + sourceFile.fileName = normalizePath(fileName); + sourceFile.flags = fileExtensionIs(sourceFile.fileName, ".d.ts") ? NodeFlags.DeclarationFile : 0; // Flags that dictate what parsing context we're in. For example: // Whether or not we are in strict parsing mode. All that changes in strict parsing mode is diff --git a/src/compiler/program.ts b/src/compiler/program.ts index dde63394b9440..e764e20f29f4a 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -15,9 +15,9 @@ module ts { // returned by CScript sys environment var unsupportedFileEncodingErrorCode = -2147024809; - function getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile { + function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile { try { - var text = sys.readFile(filename, options.charset); + var text = sys.readFile(fileName, options.charset); } catch (e) { if (onError) { @@ -28,7 +28,7 @@ module ts { text = ""; } - return text !== undefined ? createSourceFile(filename, text, languageVersion) : undefined; + return text !== undefined ? createSourceFile(fileName, text, languageVersion) : undefined; } function writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) { @@ -64,7 +64,7 @@ module ts { return { getSourceFile, - getDefaultLibFilename: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFilename(options)), + getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)), writeFile, getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()), useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, @@ -83,7 +83,7 @@ module ts { forEach(rootNames, name => processRootFile(name, false)); if (!seenNoDefaultLib) { - processRootFile(host.getDefaultLibFilename(options), true); + processRootFile(host.getDefaultLibFileName(options), true); } verifyCompilerOptions(); errors.sort(compareDiagnostics); @@ -146,9 +146,9 @@ module ts { return emitFiles(resolver, getEmitHost(), targetSourceFile); } - function getSourceFile(filename: string) { - filename = host.getCanonicalFileName(filename); - return hasProperty(filesByName, filename) ? filesByName[filename] : undefined; + function getSourceFile(fileName: string) { + fileName = host.getCanonicalFileName(fileName); + return hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; } function getDiagnostics(sourceFile?: SourceFile): Diagnostic[] { @@ -159,73 +159,73 @@ module ts { return filter(errors, e => !e.file); } - function hasExtension(filename: string): boolean { - return getBaseFilename(filename).indexOf(".") >= 0; + function hasExtension(fileName: string): boolean { + return getBaseFileName(fileName).indexOf(".") >= 0; } - function processRootFile(filename: string, isDefaultLib: boolean) { - processSourceFile(normalizePath(filename), isDefaultLib); + function processRootFile(fileName: string, isDefaultLib: boolean) { + processSourceFile(normalizePath(fileName), isDefaultLib); } - function processSourceFile(filename: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) { + function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) { if (refEnd !== undefined && refPos !== undefined) { var start = refPos; var length = refEnd - refPos; } var diagnostic: DiagnosticMessage; - if (hasExtension(filename)) { - if (!options.allowNonTsExtensions && !fileExtensionIs(host.getCanonicalFileName(filename), ".ts")) { + if (hasExtension(fileName)) { + if (!options.allowNonTsExtensions && !fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { diagnostic = Diagnostics.File_0_must_have_extension_ts_or_d_ts; } - else if (!findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = Diagnostics.File_0_not_found; } - else if (refFile && host.getCanonicalFileName(filename) === host.getCanonicalFileName(refFile.filename)) { + else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { diagnostic = Diagnostics.A_file_cannot_have_a_reference_to_itself; } } else { - if (options.allowNonTsExtensions && !findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { + if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { diagnostic = Diagnostics.File_0_not_found; } - else if (!findSourceFile(filename + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(filename + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { diagnostic = Diagnostics.File_0_not_found; - filename += ".ts"; + fileName += ".ts"; } } if (diagnostic) { if (refFile) { - errors.push(createFileDiagnostic(refFile, start, length, diagnostic, filename)); + errors.push(createFileDiagnostic(refFile, start, length, diagnostic, fileName)); } else { - errors.push(createCompilerDiagnostic(diagnostic, filename)); + errors.push(createCompilerDiagnostic(diagnostic, fileName)); } } } - // Get source file from normalized filename - function findSourceFile(filename: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile { - var canonicalName = host.getCanonicalFileName(filename); + // Get source file from normalized fileName + function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile { + var canonicalName = host.getCanonicalFileName(fileName); if (hasProperty(filesByName, canonicalName)) { // We've already looked for this file, use cached result - return getSourceFileFromCache(filename, canonicalName, /*useAbsolutePath*/ false); + return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false); } else { - var normalizedAbsolutePath = getNormalizedAbsolutePath(filename, host.getCurrentDirectory()); + var normalizedAbsolutePath = getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); if (hasProperty(filesByName, canonicalAbsolutePath)) { return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true); } // We haven't looked for this file, do so now and cache result - var file = filesByName[canonicalName] = host.getSourceFile(filename, options.target, hostErrorMessage => { + var file = filesByName[canonicalName] = host.getSourceFile(fileName, options.target, hostErrorMessage => { if (refFile) { errors.push(createFileDiagnostic(refFile, refStart, refLength, - Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage)); + Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } else { - errors.push(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, filename, hostErrorMessage)); + errors.push(createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); if (file) { @@ -235,7 +235,7 @@ module ts { filesByName[canonicalAbsolutePath] = file; if (!options.noResolve) { - var basePath = getDirectoryPath(filename); + var basePath = getDirectoryPath(fileName); processReferencedFiles(file, basePath); processImportedModules(file, basePath); } @@ -252,13 +252,13 @@ module ts { } return file; - function getSourceFileFromCache(filename: string, canonicalName: string, useAbsolutePath: boolean): SourceFile { + function getSourceFileFromCache(fileName: string, canonicalName: string, useAbsolutePath: boolean): SourceFile { var file = filesByName[canonicalName]; if (file && host.useCaseSensitiveFileNames()) { - var sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.filename, host.getCurrentDirectory()) : file.filename; + var sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { errors.push(createFileDiagnostic(refFile, refStart, refLength, - Diagnostics.Filename_0_differs_from_already_included_filename_1_only_in_casing, filename, sourceFileName)); + Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); } } return file; @@ -267,8 +267,8 @@ module ts { function processReferencedFiles(file: SourceFile, basePath: string) { forEach(file.referencedFiles, ref => { - var referencedFilename = isRootedDiskPath(ref.filename) ? ref.filename : combinePaths(basePath, ref.filename); - processSourceFile(normalizePath(referencedFilename), /* isDefaultLib */ false, file, ref.pos, ref.end); + var referencedFileName = isRootedDiskPath(ref.fileName) ? ref.fileName : combinePaths(basePath, ref.fileName); + processSourceFile(normalizePath(referencedFileName), /* isDefaultLib */ false, file, ref.pos, ref.end); }); } @@ -322,8 +322,8 @@ module ts { } }); - function findModuleSourceFile(filename: string, nameLiteral: LiteralExpression) { - return findSourceFile(filename, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + function findModuleSourceFile(fileName: string, nameLiteral: LiteralExpression) { + return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); } } @@ -359,8 +359,8 @@ module ts { forEach(files, sourceFile => { // Each file contributes into common source file path if (!(sourceFile.flags & NodeFlags.DeclarationFile) - && !fileExtensionIs(sourceFile.filename, ".js")) { - var sourcePathComponents = getNormalizedPathComponents(sourceFile.filename, host.getCurrentDirectory()); + && !fileExtensionIs(sourceFile.fileName, ".js")) { + var sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); // FileName is not part of directory if (commonPathComponents) { for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 5a7bd2ba91389..cf71869ab1401 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -88,7 +88,7 @@ module ts { if (diagnostic.file) { var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); - output += diagnostic.file.filename + "(" + loc.line + "," + loc.character + "): "; + output += diagnostic.file.fileName + "(" + loc.line + "," + loc.character + "): "; } var category = DiagnosticCategory[diagnostic.category].toLowerCase(); @@ -136,27 +136,27 @@ module ts { function findConfigFile(): string { var searchPath = normalizePath(sys.getCurrentDirectory()); - var filename = "tsconfig.json"; + var fileName = "tsconfig.json"; while (true) { - if (sys.fileExists(filename)) { - return filename; + if (sys.fileExists(fileName)) { + return fileName; } var parentPath = getDirectoryPath(searchPath); if (parentPath === searchPath) { break; } searchPath = parentPath; - filename = "../" + filename; + fileName = "../" + fileName; } return undefined; } export function executeCommandLine(args: string[]): void { var commandLine = parseCommandLine(args); - var configFilename: string; // Configuration file name (if any) + var configFileName: string; // Configuration file name (if any) var configFileWatcher: FileWatcher; // Configuration file watcher var cachedProgram: Program; // Program cached from last compilation - var rootFilenames: string[]; // Root filenames for compilation + var rootFileNames: string[]; // Root fileNames for compilation var compilerOptions: CompilerOptions; // Compiler options for compilation var compilerHost: CompilerHost; // Compiler host var hostGetSourceFile: typeof compilerHost.getSourceFile; // getSourceFile method from default host @@ -193,17 +193,17 @@ module ts { reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project")); return sys.exit(EmitReturnStatus.CompilerOptionsErrors); } - configFilename = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json")); - if (commandLine.filenames.length !== 0) { + configFileName = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json")); + if (commandLine.fileNames.length !== 0) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); return sys.exit(EmitReturnStatus.CompilerOptionsErrors); } } - else if (commandLine.filenames.length === 0 && isJSONSupported()) { - configFilename = findConfigFile(); + else if (commandLine.fileNames.length === 0 && isJSONSupported()) { + configFileName = findConfigFile(); } - if (commandLine.filenames.length === 0 && !configFilename) { + if (commandLine.fileNames.length === 0 && !configFileName) { printVersion(); printHelp(); return sys.exit(EmitReturnStatus.CompilerOptionsErrors); @@ -214,8 +214,8 @@ module ts { reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); return sys.exit(EmitReturnStatus.CompilerOptionsErrors); } - if (configFilename) { - configFileWatcher = sys.watchFile(configFilename, configFileChanged); + if (configFileName) { + configFileWatcher = sys.watchFile(configFileName, configFileChanged); } } @@ -225,22 +225,22 @@ module ts { function performCompilation() { if (!cachedProgram) { - if (configFilename) { - var configObject = readConfigFile(configFilename); + if (configFileName) { + var configObject = readConfigFile(configFileName); if (!configObject) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, configFilename)); + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, configFileName)); return sys.exit(EmitReturnStatus.CompilerOptionsErrors); } - var configParseResult = parseConfigFile(configObject, getDirectoryPath(configFilename)); + var configParseResult = parseConfigFile(configObject, getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors); return sys.exit(EmitReturnStatus.CompilerOptionsErrors); } - rootFilenames = configParseResult.filenames; + rootFileNames = configParseResult.fileNames; compilerOptions = extend(commandLine.options, configParseResult.options); } else { - rootFilenames = commandLine.filenames; + rootFileNames = commandLine.fileNames; compilerOptions = commandLine.options; } compilerHost = createCompilerHost(compilerOptions); @@ -248,7 +248,7 @@ module ts { compilerHost.getSourceFile = getSourceFile; } - var compileResult = compile(rootFilenames, compilerOptions, compilerHost); + var compileResult = compile(rootFileNames, compilerOptions, compilerHost); if (!commandLine.options.watch) { return sys.exit(compileResult.exitStatus); @@ -258,20 +258,20 @@ module ts { reportDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes)); } - function getSourceFile(filename: string, languageVersion: ScriptTarget, onError ?: (message: string) => void) { + function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError ?: (message: string) => void) { // Return existing SourceFile object if one is available if (cachedProgram) { - var sourceFile = cachedProgram.getSourceFile(filename); + var sourceFile = cachedProgram.getSourceFile(fileName); // A modified source file has no watcher and should not be reused if (sourceFile && sourceFile.fileWatcher) { return sourceFile; } } // Use default host function - var sourceFile = hostGetSourceFile(filename, languageVersion, onError); + var sourceFile = hostGetSourceFile(fileName, languageVersion, onError); if (sourceFile && commandLine.options.watch) { // Attach a file watcher - sourceFile.fileWatcher = sys.watchFile(sourceFile.filename, () => sourceFileChanged(sourceFile)); + sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, () => sourceFileChanged(sourceFile)); } return sourceFile; } @@ -321,9 +321,9 @@ module ts { } } - function compile(filenames: string[], compilerOptions: CompilerOptions, compilerHost: CompilerHost) { + function compile(fileNames: string[], compilerOptions: CompilerOptions, compilerHost: CompilerHost) { var parseStart = new Date().getTime(); - var program = createProgram(filenames, compilerOptions, compilerHost); + var program = createProgram(fileNames, compilerOptions, compilerHost); var bindStart = new Date().getTime(); var errors: Diagnostic[] = program.getDiagnostics(); @@ -359,7 +359,7 @@ module ts { if (compilerOptions.listFiles) { forEach(program.getSourceFiles(), file => { - sys.write(file.filename + sys.newLine); + sys.write(file.fileName + sys.newLine); }); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index a6fb7cdf7efea..beae064ce40c8 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -872,7 +872,7 @@ module ts { } export interface FileReference extends TextRange { - filename: string; + fileName: string; } export interface CommentRange extends TextRange { @@ -884,7 +884,7 @@ module ts { statements: NodeArray; endOfFileToken: Node; - filename: string; + fileName: string; text: string; amdDependencies: string[]; @@ -925,7 +925,7 @@ module ts { export interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; getCurrentDirectory(): string; } @@ -994,7 +994,7 @@ module ts { getCompilerHost(): CompilerHost; getSourceFiles(): SourceFile[]; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; } export interface TypeChecker { @@ -1498,14 +1498,14 @@ module ts { export interface ParsedCommandLine { options: CompilerOptions; - filenames: string[]; + fileNames: string[]; errors: Diagnostic[]; } export interface CommandLineOption { name: string; type: string | Map; // "string", "number", "boolean", or an object literal mapping named values to actual values - isFilePath?: boolean; // True if option value is a path or filename + isFilePath?: boolean; // True if option value is a path or fileName shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help' description?: DiagnosticMessage; // The message describing what the command line switch does paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter @@ -1653,10 +1653,10 @@ module ts { } export interface CompilerHost { - getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; - getDefaultLibFilename(options: CompilerOptions): string; + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getDefaultLibFileName(options: CompilerOptions): string; getCancellationToken? (): CancellationToken; - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a333af5f38355..f95952dc5c53d 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -31,7 +31,7 @@ module ts { getCanonicalFileName(fileName: string): string; getNewLine(): string; - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; } // Pool writers to avoid needing to allocate them for every symbol we write. @@ -110,7 +110,7 @@ module ts { export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); var loc = getLineAndCharacterOfPosition(file, node.pos); - return file.filename + "(" + loc.line + "," + loc.character + ")"; + return file.fileName + "(" + loc.line + "," + loc.character + ")"; } export function getStartPosOfNode(node: Node): number { @@ -746,7 +746,7 @@ module ts { export function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference) { if (!host.getCompilerOptions().noResolve) { - var referenceFileName = isRootedDiskPath(reference.filename) ? reference.filename : combinePaths(getDirectoryPath(sourceFile.filename), reference.filename); + var referenceFileName = isRootedDiskPath(reference.fileName) ? reference.fileName : combinePaths(getDirectoryPath(sourceFile.fileName), reference.fileName); referenceFileName = getNormalizedAbsolutePath(referenceFileName, host.getCurrentDirectory()); return host.getSourceFile(referenceFileName); } @@ -804,7 +804,7 @@ module ts { fileReference: { pos: start, end: end, - filename: matchResult[3] + fileName: matchResult[3] }, isNoDefaultLib: false }; diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index f0804b414be8a..b3c9c118e97ef 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -118,7 +118,7 @@ module FourSlash { baselineFile: 'BaselineFile', declaration: 'declaration', emitThisFile: 'emitThisFile', // This flag is used for testing getEmitOutput feature. It allows test-cases to indicate what file to be output in multiple files project - filename: 'Filename', + fileName: 'Filename', mapRoot: 'mapRoot', module: 'module', out: 'out', @@ -129,7 +129,7 @@ module FourSlash { }; // List of allowed metadata names - var fileMetadataNames = [testOptMetadataNames.filename, testOptMetadataNames.emitThisFile, testOptMetadataNames.resolveReference]; + var fileMetadataNames = [testOptMetadataNames.fileName, testOptMetadataNames.emitThisFile, testOptMetadataNames.resolveReference]; var globalMetadataNames = [testOptMetadataNames.baselineFile, testOptMetadataNames.declaration, testOptMetadataNames.mapRoot, testOptMetadataNames.module, testOptMetadataNames.out, testOptMetadataNames.outDir, testOptMetadataNames.sourceMap, testOptMetadataNames.sourceRoot] @@ -268,7 +268,7 @@ module FourSlash { private scenarioActions: string[] = []; private taoInvalidReason: string = null; - private inputFiles: ts.Map = {}; // Map between inputFile's filename and its content for easily looking up when resolving references + private inputFiles: ts.Map = {}; // Map between inputFile's fileName and its content for easily looking up when resolving references // Add input file which has matched file name with the given reference-file path. // This is necessary when resolveReference flag is specified @@ -360,9 +360,9 @@ module FourSlash { }; this.testData.files.forEach(file => { - var filename = file.fileName.replace(Harness.IO.directoryName(file.fileName), '').substr(1); - var filenameWithoutExtension = filename.substr(0, filename.lastIndexOf(".")); - this.scenarioActions.push(''); + var fileName = file.fileName.replace(Harness.IO.directoryName(file.fileName), '').substr(1); + var fileNameWithoutExtension = fileName.substr(0, fileName.lastIndexOf(".")); + this.scenarioActions.push(''); }); // Open the first file by default @@ -409,8 +409,8 @@ module FourSlash { var fileToOpen: FourSlashFile = this.findFile(indexOrName); fileToOpen.fileName = ts.normalizeSlashes(fileToOpen.fileName); this.activeFile = fileToOpen; - var filename = fileToOpen.fileName.replace(Harness.IO.directoryName(fileToOpen.fileName), '').substr(1); - this.scenarioActions.push(''); + var fileName = fileToOpen.fileName.replace(Harness.IO.directoryName(fileToOpen.fileName), '').substr(1); + this.scenarioActions.push(''); } public verifyErrorExistsBetweenMarkers(startMarkerName: string, endMarkerName: string, negative: boolean) { @@ -730,7 +730,7 @@ module FourSlash { var localFiles = this.testData.files.map(file => file.fileName); // Count only the references in local files. Filter the ones in lib and other files. ts.forEach(references, entry => { - if (localFiles.some((filename) => filename === entry.fileName)) { + if (localFiles.some((fileName) => fileName === entry.fileName)) { ++referencesCount; } }); @@ -1143,8 +1143,8 @@ module FourSlash { resultString += "EmitOutputStatus : " + ts.EmitReturnStatus[emitOutputStatus]; resultString += "\n"; emitOutput.outputFiles.forEach((outputFile, idx, array) => { - var filename = "Filename : " + outputFile.name + "\n"; - resultString = resultString + filename + outputFile.text; + var fileName = "FileName : " + outputFile.name + "\n"; + resultString = resultString + fileName + outputFile.text; }); resultString += "\n"; }); @@ -2131,7 +2131,7 @@ module FourSlash { } } else if (typeof indexOrName === 'string') { var name = indexOrName; - // names are stored in the compiler with this relative path, this allows people to use goTo.file on just the filename + // names are stored in the compiler with this relative path, this allows people to use goTo.file on just the fileName name = name.indexOf('/') === -1 ? 'tests/cases/fourslash/' + name : name; var availableNames: string[] = []; var foundIt = false; @@ -2203,13 +2203,13 @@ module FourSlash { currentTestState = new TestState(testData); var result = ''; - var host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFilename, content: undefined }, + var host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFileName, content: undefined }, { unitName: fileName, content: content }], (fn, contents) => result = contents, ts.ScriptTarget.Latest, ts.sys.useCaseSensitiveFileNames); // TODO (drosen): We need to enforce checking on these tests. - var program = ts.createProgram([Harness.Compiler.fourslashFilename, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host); + var program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host); var checker = ts.createTypeChecker(program, /*produceDiagnostics*/ true); var errors = program.getDiagnostics().concat(checker.getDiagnostics()); @@ -2296,8 +2296,8 @@ module FourSlash { if (globalMetadataNamesIndex === -1) { if (fileMetadataNamesIndex === -1) { throw new Error('Unrecognized metadata name "' + match[1] + '". Available global metadata names are: ' + globalMetadataNames.join(', ') + '; file metadata names are: ' + fileMetadataNames.join(', ')); - } else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(testOptMetadataNames.filename)) { - // Found an @Filename directive, if this is not the first then create a new subfile + } else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(testOptMetadataNames.fileName)) { + // Found an @FileName directive, if this is not the first then create a new subfile if (currentFileContent) { var file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges); file.fileOptions = currentFileOptions; diff --git a/src/harness/harness.ts b/src/harness/harness.ts index dc984aaf60dd5..c17a8da78e8b5 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -52,7 +52,7 @@ module Utils { export var currentExecutionEnvironment = getExecutionEnvironment(); - export function evalFile(fileContents: string, filename: string, nodeContext?: any) { + export function evalFile(fileContents: string, fileName: string, nodeContext?: any) { var environment = getExecutionEnvironment(); switch (environment) { case ExecutionEnvironment.CScript: @@ -62,9 +62,9 @@ module Utils { case ExecutionEnvironment.Node: var vm = require('vm'); if (nodeContext) { - vm.runInNewContext(fileContents, nodeContext, filename); + vm.runInNewContext(fileContents, nodeContext, fileName); } else { - vm.runInThisContext(fileContents, filename); + vm.runInThisContext(fileContents, fileName); } break; default: @@ -389,9 +389,9 @@ module Harness { writeFile(path: string, contents: string): void; directoryName(path: string): string; createDirectory(path: string): void; - fileExists(filename: string): boolean; + fileExists(fileName: string): boolean; directoryExists(path: string): boolean; - deleteFile(filename: string): void; + deleteFile(fileName: string): void; listFiles(path: string, filter: RegExp, options?: { recursive?: boolean }): string[]; log(text: string): void; getMemoryUsage? (): number; @@ -621,7 +621,7 @@ module Harness { // root of the server if (dirPath.match(/localhost:\d+$/) || dirPath.match(/localhost:\d+\/$/)) { dirPath = null; - // path + filename + // path + fileName } else if (dirPath.indexOf('.') === -1) { dirPath = dirPath.substring(0, dirPath.lastIndexOf('/')); // path @@ -692,26 +692,26 @@ module Harness { module Harness { - var tcServicesFilename = "typescriptServices.js"; + var tcServicesFileName = "typescriptServices.js"; export var libFolder: string; switch (Utils.getExecutionEnvironment()) { case Utils.ExecutionEnvironment.CScript: libFolder = "built/local/"; - tcServicesFilename = "built/local/typescriptServices.js"; + tcServicesFileName = "built/local/typescriptServices.js"; break; case Utils.ExecutionEnvironment.Node: libFolder = "built/local/"; - tcServicesFilename = "built/local/typescriptServices.js"; + tcServicesFileName = "built/local/typescriptServices.js"; break; case Utils.ExecutionEnvironment.Browser: libFolder = "built/local/"; - tcServicesFilename = "built/local/typescriptServices.js"; + tcServicesFileName = "built/local/typescriptServices.js"; break; default: throw new Error('Unknown context'); } - export var tcServicesFile = IO.readFile(tcServicesFilename); + export var tcServicesFile = IO.readFile(tcServicesFileName); export interface SourceMapEmitterCallback { (emittedFile: string, emittedLine: number, emittedColumn: number, sourceFile: string, sourceLine: number, sourceColumn: number, sourceName: string): void; @@ -800,7 +800,7 @@ module Harness { // Cache these between executions so we don't have to re-parse them for every test - export var fourslashFilename = 'fourslash.ts'; + export var fourslashFileName = 'fourslash.ts'; export var fourslashSourceFile: ts.SourceFile; export function getCanonicalFileName(fileName: string): string { @@ -819,14 +819,14 @@ module Harness { return useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); } - var filemap: { [filename: string]: ts.SourceFile; } = {}; + var filemap: { [fileName: string]: ts.SourceFile; } = {}; var getCurrentDirectory = currentDirectory === undefined ? ts.sys.getCurrentDirectory : () => currentDirectory; // Register input files function register(file: { unitName: string; content: string; }) { if (file.content !== undefined) { - var filename = ts.normalizeSlashes(file.unitName); - filemap[getCanonicalFileName(filename)] = ts.createSourceFile(filename, file.content, scriptTarget); + var fileName = ts.normalizeSlashes(file.unitName); + filemap[getCanonicalFileName(fileName)] = ts.createSourceFile(fileName, file.content, scriptTarget); } }; inputFiles.forEach(register); @@ -841,8 +841,8 @@ module Harness { var canonicalAbsolutePath = getCanonicalFileName(ts.getNormalizedAbsolutePath(fn, currentDirectory)); return Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(canonicalAbsolutePath)) ? filemap[canonicalAbsolutePath] : undefined; } - else if (fn === fourslashFilename) { - var tsFn = 'tests/cases/fourslash/' + fourslashFilename; + else if (fn === fourslashFileName) { + var tsFn = 'tests/cases/fourslash/' + fourslashFileName; fourslashSourceFile = fourslashSourceFile || ts.createSourceFile(tsFn, Harness.IO.readFile(tsFn), scriptTarget); return fourslashSourceFile; } @@ -854,7 +854,7 @@ module Harness { return undefined; } }, - getDefaultLibFilename: options => defaultLibFileName, + getDefaultLibFileName: options => defaultLibFileName, writeFile, getCanonicalFileName, useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, @@ -935,7 +935,7 @@ module Harness { var useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames; this.settings.forEach(setting => { switch (setting.flag.toLowerCase()) { - // "filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve" + // "fileName", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve" case "module": case "modulegentarget": if (typeof setting.value === 'string') { @@ -1066,8 +1066,8 @@ module Harness { var filemap: { [name: string]: ts.SourceFile; } = {}; var register = (file: { unitName: string; content: string; }) => { if (file.content !== undefined) { - var filename = ts.normalizeSlashes(file.unitName); - filemap[getCanonicalFileName(filename)] = ts.createSourceFile(filename, file.content, options.target); + var fileName = ts.normalizeSlashes(file.unitName); + filemap[getCanonicalFileName(fileName)] = ts.createSourceFile(fileName, file.content, options.target); } }; inputFiles.forEach(register); @@ -1148,12 +1148,12 @@ module Harness { var sourceFileName: string; if (ts.isExternalModule(sourceFile) || !options.out) { if (options.outDir) { - var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.filename, result.currentDirectoryForProgram); + var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, result.currentDirectoryForProgram); sourceFilePath = sourceFilePath.replace(result.program.getCommonSourceDirectory(), ""); sourceFileName = ts.combinePaths(options.outDir, sourceFilePath); } else { - sourceFileName = sourceFile.filename; + sourceFileName = sourceFile.fileName; } } else { @@ -1184,7 +1184,7 @@ module Harness { export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic { var errorLineInfo = err.file ? err.file.getLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 }; return { - filename: err.file && err.file.filename, + fileName: err.file && err.file.fileName, start: err.start, end: err.start + err.length, line: errorLineInfo.line, @@ -1199,8 +1199,8 @@ module Harness { // This is basically copied from tsc.ts's reportError to replicate what tsc does var errorOutput = ""; ts.forEach(diagnostics, diagnotic => { - if (diagnotic.filename) { - errorOutput += diagnotic.filename + "(" + diagnotic.line + "," + diagnotic.character + "): "; + if (diagnotic.fileName) { + errorOutput += diagnotic.fileName + "(" + diagnotic.line + "," + diagnotic.character + "): "; } errorOutput += diagnotic.category + " TS" + diagnotic.code + ": " + diagnotic.message + ts.sys.newLine; @@ -1210,7 +1210,7 @@ module Harness { } function compareDiagnostics(d1: HarnessDiagnostic, d2: HarnessDiagnostic) { - return ts.compareValues(d1.filename, d2.filename) || + return ts.compareValues(d1.fileName, d2.fileName) || ts.compareValues(d1.start, d2.start) || ts.compareValues(d1.end, d2.end) || ts.compareValues(d1.code, d2.code) || @@ -1236,14 +1236,14 @@ module Harness { } // Report global errors - var globalErrors = diagnostics.filter(err => !err.filename); + var globalErrors = diagnostics.filter(err => !err.fileName); globalErrors.forEach(outputErrorText); // 'merge' the lines of each input file with any errors associated with it inputFiles.filter(f => f.content !== undefined).forEach(inputFile => { // Filter down to the errors in the file var fileErrors = diagnostics.filter(e => { - var errFn = e.filename; + var errFn = e.fileName; return errFn && errFn === inputFile.unitName; }); @@ -1307,12 +1307,12 @@ module Harness { }); var numLibraryDiagnostics = ts.countWhere(diagnostics, diagnostic => { - return diagnostic.filename && isLibraryFile(diagnostic.filename); + return diagnostic.fileName && isLibraryFile(diagnostic.fileName); }); var numTest262HarnessDiagnostics = ts.countWhere(diagnostics, diagnostic => { // Count an error generated from tests262-harness folder.This should only apply for test262 - return diagnostic.filename && diagnostic.filename.indexOf("test262-harness") >= 0; + return diagnostic.fileName && diagnostic.fileName.indexOf("test262-harness") >= 0; }); // Verify we didn't miss any errors in total @@ -1323,7 +1323,7 @@ module Harness { } export function collateOutputs(outputFiles: Harness.Compiler.GeneratedFile[], clean?: (s: string) => string) { - // Collect, test, and sort the filenames + // Collect, test, and sort the fileNames function cleanName(fn: string) { var lastSlash = ts.normalizeSlashes(fn).lastIndexOf('/'); return fn.substr(lastSlash + 1).toLowerCase(); @@ -1336,7 +1336,7 @@ module Harness { // Some extra spacing if this isn't the first file if (result.length) result = result + '\r\n\r\n'; - // Filename header + content + // FileName header + content result = result + '/*====== ' + outputFile.fileName + ' ======*/\r\n'; if (clean) { result = result + clean(outputFile.code); @@ -1366,7 +1366,7 @@ module Harness { } export interface HarnessDiagnostic { - filename: string; + fileName: string; start: number; end: number; line: number; @@ -1481,7 +1481,7 @@ module Harness { return opts; } - /** Given a test file containing // @Filename directives, return an array of named units of code to be added to an existing compiler instance */ + /** Given a test file containing // @FileName directives, return an array of named units of code to be added to an existing compiler instance */ export function makeUnitsFromTest(code: string, fileName: string): { settings: CompilerSetting[]; testUnitData: TestUnitData[]; } { var settings = extractCompilerSettings(code); @@ -1599,7 +1599,7 @@ module Harness { } var fileCache: { [idx: string]: boolean } = {}; - function generateActual(actualFilename: string, generateContent: () => string): string { + function generateActual(actualFileName: string, generateContent: () => string): string { // For now this is written using TypeScript, because sys is not available when running old test cases. // But we need to move to sys once we have // Creates the directory including its parent if not already present @@ -1618,11 +1618,11 @@ module Harness { } // Create folders if needed - createDirectoryStructure(Harness.IO.directoryName(actualFilename)); + createDirectoryStructure(Harness.IO.directoryName(actualFileName)); // Delete the actual file in case it fails - if (IO.fileExists(actualFilename)) { - IO.deleteFile(actualFilename); + if (IO.fileExists(actualFileName)) { + IO.deleteFile(actualFileName); } var actual = generateContent(); @@ -1634,13 +1634,13 @@ module Harness { // Store the content in the 'local' folder so we // can accept it later (manually) if (actual !== null) { - IO.writeFile(actualFilename, actual); + IO.writeFile(actualFileName, actual); } return actual; } - function compareToBaseline(actual: string, relativeFilename: string, opts: BaselineOptions) { + function compareToBaseline(actual: string, relativeFileName: string, opts: BaselineOptions) { // actual is now either undefined (the generator had an error), null (no file requested), // or some real output of the function if (actual === undefined) { @@ -1648,15 +1648,15 @@ module Harness { return; } - var refFilename = referencePath(relativeFilename, opts && opts.Baselinefolder, opts && opts.Subfolder); + var refFileName = referencePath(relativeFileName, opts && opts.Baselinefolder, opts && opts.Subfolder); if (actual === null) { actual = ''; } var expected = ''; - if (IO.fileExists(refFilename)) { - expected = IO.readFile(refFilename); + if (IO.fileExists(refFileName)) { + expected = IO.readFile(refFileName); } var lineEndingSensitive = opts && opts.LineEndingSensitive; @@ -1669,34 +1669,34 @@ module Harness { return { expected, actual }; } - function writeComparison(expected: string, actual: string, relativeFilename: string, actualFilename: string, descriptionForDescribe: string) { + function writeComparison(expected: string, actual: string, relativeFileName: string, actualFileName: string, descriptionForDescribe: string) { var encoded_actual = (new Buffer(actual)).toString('utf8') if (expected != encoded_actual) { // Overwrite & issue error - var errMsg = 'The baseline file ' + relativeFilename + ' has changed'; + var errMsg = 'The baseline file ' + relativeFileName + ' has changed'; throw new Error(errMsg); } } export function runBaseline( descriptionForDescribe: string, - relativeFilename: string, + relativeFileName: string, generateContent: () => string, runImmediately = false, opts?: BaselineOptions): void { var actual = undefined; - var actualFilename = localPath(relativeFilename, opts && opts.Baselinefolder, opts && opts.Subfolder); + var actualFileName = localPath(relativeFileName, opts && opts.Baselinefolder, opts && opts.Subfolder); if (runImmediately) { - actual = generateActual(actualFilename, generateContent); - var comparison = compareToBaseline(actual, relativeFilename, opts); - writeComparison(comparison.expected, comparison.actual, relativeFilename, actualFilename, descriptionForDescribe); + actual = generateActual(actualFileName, generateContent); + var comparison = compareToBaseline(actual, relativeFileName, opts); + writeComparison(comparison.expected, comparison.actual, relativeFileName, actualFileName, descriptionForDescribe); } else { - actual = generateActual(actualFilename, generateContent); + actual = generateActual(actualFileName, generateContent); - var comparison = compareToBaseline(actual, relativeFilename, opts); - writeComparison(comparison.expected, comparison.actual, relativeFilename, actualFilename, descriptionForDescribe); + var comparison = compareToBaseline(actual, relativeFileName, opts); + writeComparison(comparison.expected, comparison.actual, relativeFileName, actualFileName, descriptionForDescribe); } } } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 5c6b0ff35b307..d7510c7879e98 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -210,7 +210,7 @@ module Harness.LanguageService { return ""; } - public getDefaultLibFilename(): string { + public getDefaultLibFileName(): string { return ""; } diff --git a/src/harness/loggedIO.ts b/src/harness/loggedIO.ts index 570352625815d..d9418c0e6aed5 100644 --- a/src/harness/loggedIO.ts +++ b/src/harness/loggedIO.ts @@ -60,18 +60,18 @@ interface IOLog { } interface PlaybackControl { - startReplayFromFile(logFilename: string): void; + startReplayFromFile(logFileName: string): void; startReplayFromString(logContents: string): void; startReplayFromData(log: IOLog): void; endReplay(): void; - startRecord(logFilename: string): void; + startRecord(logFileName: string): void; endRecord(): void; } module Playback { var recordLog: IOLog = undefined; var replayLog: IOLog = undefined; - var recordLogFilenameBase = ''; + var recordLogFileNameBase = ''; interface Memoized { (s: string): T; @@ -130,8 +130,8 @@ module Playback { replayLog = undefined; }; - wrapper.startRecord = (filenameBase) => { - recordLogFilenameBase = filenameBase; + wrapper.startRecord = (fileNameBase) => { + recordLogFileNameBase = fileNameBase; recordLog = createEmptyLog(); }; } @@ -176,7 +176,7 @@ module Playback { function findResultByPath(wrapper: { resolvePath(s: string): string }, logArray: { path: string; result?: T }[], expectedPath: string, defaultValue?: T): T { var normalizedName = ts.normalizeSlashes(expectedPath).toLowerCase(); - // Try to find the result through normal filename + // Try to find the result through normal fileName for (var i = 0; i < logArray.length; i++) { if (ts.normalizeSlashes(logArray[i].path).toLowerCase() === normalizedName) { return logArray[i].result; @@ -231,7 +231,7 @@ module Playback { wrapper.endRecord = () => { if (recordLog !== undefined) { var i = 0; - var fn = () => recordLogFilenameBase + i + '.json'; + var fn = () => recordLogFileNameBase + i + '.json'; while (underlying.fileExists(fn())) i++; underlying.writeFile(fn(), JSON.stringify(recordLog)); recordLog = undefined; diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 9b16e93d8eb9f..fac5219f5c10e 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -91,8 +91,8 @@ class ProjectRunner extends RunnerBase { // We have these two separate locations because when comparing baselines the baseline verifier will delete the existing file // so even if it was created by compiler in that location, the file will be deleted by verified before we can read it // so lets keep these two locations separate - function getProjectOutputFolder(filename: string, moduleKind: ts.ModuleKind) { - return Harness.Baseline.localPath("projectOutput/" + testCaseJustName + "/" + moduleNameToString(moduleKind) + "/" + filename); + function getProjectOutputFolder(fileName: string, moduleKind: ts.ModuleKind) { + return Harness.Baseline.localPath("projectOutput/" + testCaseJustName + "/" + moduleNameToString(moduleKind) + "/" + fileName); } function cleanProjectUrl(url: string) { @@ -123,8 +123,8 @@ class ProjectRunner extends RunnerBase { } function compileProjectFiles(moduleKind: ts.ModuleKind, getInputFiles: ()=> string[], - getSourceFileText: (filename: string) => string, - writeFile: (filename: string, data: string, writeByteOrderMark: boolean) => void): CompileProjectFilesResult { + getSourceFileText: (fileName: string) => string, + writeFile: (fileName: string, data: string, writeByteOrderMark: boolean) => void): CompileProjectFilesResult { var program = ts.createProgram(getInputFiles(), createCompilerOptions(), createCompilerHost()); var errors = program.getDiagnostics(); @@ -168,15 +168,15 @@ class ProjectRunner extends RunnerBase { }; } - function getSourceFile(filename: string, languageVersion: ts.ScriptTarget): ts.SourceFile { + function getSourceFile(fileName: string, languageVersion: ts.ScriptTarget): ts.SourceFile { var sourceFile: ts.SourceFile = undefined; - if (filename === Harness.Compiler.defaultLibFileName) { + if (fileName === Harness.Compiler.defaultLibFileName) { sourceFile = languageVersion === ts.ScriptTarget.ES6 ? Harness.Compiler.defaultES6LibSourceFile : Harness.Compiler.defaultLibSourceFile; } else { - var text = getSourceFileText(filename); + var text = getSourceFileText(fileName); if (text !== undefined) { - sourceFile = ts.createSourceFile(filename, text, languageVersion); + sourceFile = ts.createSourceFile(fileName, text, languageVersion); } } @@ -186,7 +186,7 @@ class ProjectRunner extends RunnerBase { function createCompilerHost(): ts.CompilerHost { return { getSourceFile, - getDefaultLibFilename: options => Harness.Compiler.defaultLibFileName, + getDefaultLibFileName: options => Harness.Compiler.defaultLibFileName, writeFile, getCurrentDirectory, getCanonicalFileName: Harness.Compiler.getCanonicalFileName, @@ -211,11 +211,11 @@ class ProjectRunner extends RunnerBase { nonSubfolderDiskFiles, }; - function getSourceFileText(filename: string): string { + function getSourceFileText(fileName: string): string { try { - var text = ts.sys.readFile(ts.isRootedDiskPath(filename) - ? filename - : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(filename)); + var text = ts.sys.readFile(ts.isRootedDiskPath(fileName) + ? fileName + : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(fileName)); } catch (e) { // text doesn't get defined. @@ -223,30 +223,30 @@ class ProjectRunner extends RunnerBase { return text; } - function writeFile(filename: string, data: string, writeByteOrderMark: boolean) { - var diskFileName = ts.isRootedDiskPath(filename) - ? filename - : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(filename); + function writeFile(fileName: string, data: string, writeByteOrderMark: boolean) { + var diskFileName = ts.isRootedDiskPath(fileName) + ? fileName + : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(fileName); var diskRelativeName = ts.getRelativePathToDirectoryOrUrl(testCase.projectRoot, diskFileName, getCurrentDirectory(), Harness.Compiler.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); if (ts.isRootedDiskPath(diskRelativeName) || diskRelativeName.substr(0, 3) === "../") { // If the generated output file resides in the parent folder or is rooted path, // we need to instead create files that can live in the project reference folder - // but make sure extension of these files matches with the filename the compiler asked to write + // but make sure extension of these files matches with the fileName the compiler asked to write diskRelativeName = "diskFile" + nonSubfolderDiskFiles++ + - (Harness.Compiler.isDTS(filename) ? ".d.ts" : - Harness.Compiler.isJS(filename) ? ".js" : ".js.map"); + (Harness.Compiler.isDTS(fileName) ? ".d.ts" : + Harness.Compiler.isJS(fileName) ? ".js" : ".js.map"); } - if (Harness.Compiler.isJS(filename)) { + if (Harness.Compiler.isJS(fileName)) { // Make sure if there is URl we have it cleaned up var indexOfSourceMapUrl = data.lastIndexOf("//# sourceMappingURL="); if (indexOfSourceMapUrl != -1) { data = data.substring(0, indexOfSourceMapUrl + 21) + cleanProjectUrl(data.substring(indexOfSourceMapUrl + 21)); } } - else if (Harness.Compiler.isJSMap(filename)) { + else if (Harness.Compiler.isJSMap(fileName)) { // Make sure sources list is cleaned var sourceMapData = JSON.parse(data); for (var i = 0; i < sourceMapData.sources.length; i++) { @@ -269,7 +269,7 @@ class ProjectRunner extends RunnerBase { ensureDirectoryStructure(ts.getDirectoryPath(ts.normalizePath(outputFilePath))); ts.sys.writeFile(outputFilePath, data, writeByteOrderMark); - outputFiles.push({ emittedFileName: filename, code: data, fileName: diskRelativeName, writeByteOrderMark: writeByteOrderMark }); + outputFiles.push({ emittedFileName: fileName, code: data, fileName: diskRelativeName, writeByteOrderMark: writeByteOrderMark }); } } @@ -278,17 +278,17 @@ class ProjectRunner extends RunnerBase { var compilerOptions = compilerResult.program.getCompilerOptions(); var compilerHost = compilerResult.program.getCompilerHost(); ts.forEach(compilerResult.program.getSourceFiles(), sourceFile => { - if (Harness.Compiler.isDTS(sourceFile.filename)) { - allInputFiles.unshift({ emittedFileName: sourceFile.filename, code: sourceFile.text }); + if (Harness.Compiler.isDTS(sourceFile.fileName)) { + allInputFiles.unshift({ emittedFileName: sourceFile.fileName, code: sourceFile.text }); } else if (ts.shouldEmitToOwnFile(sourceFile, compilerResult.program.getCompilerOptions())) { if (compilerOptions.outDir) { - var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.filename, compilerHost.getCurrentDirectory()); + var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, compilerHost.getCurrentDirectory()); sourceFilePath = sourceFilePath.replace(compilerResult.program.getCommonSourceDirectory(), ""); var emitOutputFilePathWithoutExtension = ts.removeFileExtension(ts.combinePaths(compilerOptions.outDir, sourceFilePath)); } else { - var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.filename); + var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); } var outputDtsFileName = emitOutputFilePathWithoutExtension + ".d.ts"; @@ -311,19 +311,19 @@ class ProjectRunner extends RunnerBase { function getInputFiles() { return ts.map(allInputFiles, outputFile => outputFile.emittedFileName); } - function getSourceFileText(filename: string): string { - return ts.forEach(allInputFiles, inputFile => inputFile.emittedFileName === filename ? inputFile.code : undefined); + function getSourceFileText(fileName: string): string { + return ts.forEach(allInputFiles, inputFile => inputFile.emittedFileName === fileName ? inputFile.code : undefined); } - function writeFile(filename: string, data: string, writeByteOrderMark: boolean) { + function writeFile(fileName: string, data: string, writeByteOrderMark: boolean) { } } function getErrorsBaseline(compilerResult: CompileProjectFilesResult) { var inputFiles = ts.map(ts.filter(compilerResult.program.getSourceFiles(), - sourceFile => sourceFile.filename !== "lib.d.ts"), + sourceFile => sourceFile.fileName !== "lib.d.ts"), sourceFile => { - return { unitName: sourceFile.filename, content: sourceFile.text }; + return { unitName: sourceFile.fileName, content: sourceFile.text }; }); var diagnostics = ts.map(compilerResult.errors, error => Harness.Compiler.getMinimalDiagnostic(error)); @@ -348,7 +348,7 @@ class ProjectRunner extends RunnerBase { baselineCheck: testCase.baselineCheck, runTest: testCase.runTest, bug: testCase.bug, - resolvedInputFiles: ts.map(compilerResult.program.getSourceFiles(), inputFile => inputFile.filename), + resolvedInputFiles: ts.map(compilerResult.program.getSourceFiles(), inputFile => inputFile.fileName), emittedFiles: ts.map(compilerResult.outputFiles, outputFile => outputFile.emittedFileName) }; diff --git a/src/harness/runnerbase.ts b/src/harness/runnerbase.ts index d22048db996b6..49ca796448a47 100644 --- a/src/harness/runnerbase.ts +++ b/src/harness/runnerbase.ts @@ -22,7 +22,7 @@ class RunnerBase { throw new Error('method not implemented'); } - /** Replaces instances of full paths with filenames only */ + /** Replaces instances of full paths with fileNames only */ static removeFullPaths(path: string) { var fixedPath = path; diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 17b524bf0cd49..b66322f839021 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -59,7 +59,7 @@ module RWC { runWithIOLog(ioLog, () => { harnessCompiler.reset(); // Load the files - ts.forEach(opts.filenames, fileName => { + ts.forEach(opts.fileNames, fileName => { inputFiles.push(getHarnessCompilerInputUnit(fileName)); }); @@ -186,7 +186,7 @@ class RWCRunner extends RunnerBase { } } - private runTest(jsonFilename: string) { - RWC.runRWCTest(jsonFilename); + private runTest(jsonFileName: string) { + RWC.runRWCTest(jsonFileName); } } \ No newline at end of file diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 423ee5e58a69a..771fe48219f1c 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -404,9 +404,9 @@ module ts.NavigationBar { } hasGlobalNode = true; - var rootName = isExternalModule(node) ? - "\"" + escapeString(getBaseFilename(removeFileExtension(normalizePath(node.filename)))) + "\"" : - "" + var rootName = isExternalModule(node) + ? "\"" + escapeString(getBaseFileName(removeFileExtension(normalizePath(node.fileName)))) + "\"" + : "" return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, diff --git a/src/services/services.ts b/src/services/services.ts index a7525709a0571..630e5567beb54 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -718,7 +718,7 @@ module ts { class SourceFileObject extends NodeObject implements SourceFile { public _declarationBrand: any; - public filename: string; + public fileName: string; public text: string; public scriptSnapshot: IScriptSnapshot; public lineMap: number[]; @@ -867,7 +867,7 @@ module ts { getLocalizedDiagnosticMessages?(): any; getCancellationToken?(): CancellationToken; getCurrentDirectory(): string; - getDefaultLibFilename(options: CompilerOptions): string; + getDefaultLibFileName(options: CompilerOptions): string; log? (s: string): void; trace? (s: string): void; error? (s: string): void; @@ -921,7 +921,7 @@ module ts { getProgram(): Program; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; dispose(): void; } @@ -1192,11 +1192,11 @@ module ts { */ export interface DocumentRegistry { /** - * Request a stored SourceFile with a given filename and compilationSettings. + * Request a stored SourceFile with a given fileName and compilationSettings. * The first call to acquire will call createLanguageServiceSourceFile to generate * the SourceFile if was not found in the registry. * - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -1206,13 +1206,13 @@ module ts { * in the registry and a new one was created. */ acquireDocument( - filename: string, + fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** - * Request an updated version of an already existing SourceFile with a given filename + * Request an updated version of an already existing SourceFile with a given fileName * and compilationSettings. The update will intern call updateLanguageServiceSourceFile * to get an updated SourceFile. * @@ -1220,7 +1220,7 @@ module ts { * registry originally. * * @param sourceFile The original sourceFile object to update - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -1233,7 +1233,7 @@ module ts { */ updateDocument( sourceFile: SourceFile, - filename: string, + fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, @@ -1245,10 +1245,10 @@ module ts { * Note: It is not allowed to call release on a SourceFile that was not acquired from * this registry originally. * - * @param filename The name of the file to be released + * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(filename: string, compilationSettings: CompilerOptions): void + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void } // TODO: move these to enums @@ -1369,7 +1369,7 @@ module ts { /// Language Service interface CompletionSession { - filename: string; // the file where the completion was requested + fileName: string; // the file where the completion was requested position: number; // position in the file where the completion was requested entries: CompletionEntry[]; // entries for this completion symbols: Map; // symbols by entry name map @@ -1385,7 +1385,7 @@ module ts { // Information about a specific host file. interface HostFileInformation { - hostFilename: string; + hostFileName: string; version: string; scriptSnapshot: IScriptSnapshot; } @@ -1468,17 +1468,17 @@ module ts { // at each language service public entry point, since we don't know when // set of scripts handled by the host changes. class HostCache { - private filenameToEntry: Map; + private fileNameToEntry: Map; private _compilationSettings: CompilerOptions; constructor(private host: LanguageServiceHost) { // script id => script index - this.filenameToEntry = {}; + this.fileNameToEntry = {}; // Initialize the list with the root file names - var rootFilenames = host.getScriptFileNames(); - for (var i = 0, n = rootFilenames.length; i < n; i++) { - this.createEntry(rootFilenames[i]); + var rootFileNames = host.getScriptFileNames(); + for (var i = 0, n = rootFileNames.length; i < n; i++) { + this.createEntry(rootFileNames[i]); } // store the compilation settings @@ -1489,64 +1489,64 @@ module ts { return this._compilationSettings; } - private createEntry(filename: string) { + private createEntry(fileName: string) { var entry: HostFileInformation; - var scriptSnapshot = this.host.getScriptSnapshot(filename); + var scriptSnapshot = this.host.getScriptSnapshot(fileName); if (scriptSnapshot) { entry = { - hostFilename: filename, - version: this.host.getScriptVersion(filename), + hostFileName: fileName, + version: this.host.getScriptVersion(fileName), scriptSnapshot: scriptSnapshot }; } - return this.filenameToEntry[normalizeSlashes(filename)] = entry; + return this.fileNameToEntry[normalizeSlashes(fileName)] = entry; } - public getEntry(filename: string): HostFileInformation { - return lookUp(this.filenameToEntry, normalizeSlashes(filename)); + public getEntry(fileName: string): HostFileInformation { + return lookUp(this.fileNameToEntry, normalizeSlashes(fileName)); } - public contains(filename: string): boolean { - return hasProperty(this.filenameToEntry, normalizeSlashes(filename)); + public contains(fileName: string): boolean { + return hasProperty(this.fileNameToEntry, normalizeSlashes(fileName)); } - public getOrCreateEntry(filename: string): HostFileInformation { - if (this.contains(filename)) { - return this.getEntry(filename); + public getOrCreateEntry(fileName: string): HostFileInformation { + if (this.contains(fileName)) { + return this.getEntry(fileName); } - return this.createEntry(filename); + return this.createEntry(fileName); } - public getRootFilenames(): string[] { + public getRootFileNames(): string[] { var fileNames: string[] = []; - forEachKey(this.filenameToEntry, key => { - if (hasProperty(this.filenameToEntry, key) && this.filenameToEntry[key]) + forEachKey(this.fileNameToEntry, key => { + if (hasProperty(this.fileNameToEntry, key) && this.fileNameToEntry[key]) fileNames.push(key); }); return fileNames; } - public getVersion(filename: string): string { - var file = this.getEntry(filename); + public getVersion(fileName: string): string { + var file = this.getEntry(fileName); return file && file.version; } - public getScriptSnapshot(filename: string): IScriptSnapshot { - var file = this.getEntry(filename); + public getScriptSnapshot(fileName: string): IScriptSnapshot { + var file = this.getEntry(fileName); return file && file.scriptSnapshot; } - public getChangeRange(filename: string, lastKnownVersion: string, oldScriptSnapshot: IScriptSnapshot): TextChangeRange { - var currentVersion = this.getVersion(filename); + public getChangeRange(fileName: string, lastKnownVersion: string, oldScriptSnapshot: IScriptSnapshot): TextChangeRange { + var currentVersion = this.getVersion(fileName); if (lastKnownVersion === currentVersion) { return unchangedTextChangeRange; // "No changes" } - var scriptSnapshot = this.getScriptSnapshot(filename); + var scriptSnapshot = this.getScriptSnapshot(fileName); return scriptSnapshot.getChangeRange(oldScriptSnapshot); } } @@ -1556,7 +1556,7 @@ module ts { // For our syntactic only features, we also keep a cache of the syntax tree for the // currently edited file. - private currentFilename: string = ""; + private currentFileName: string = ""; private currentFileVersion: string = null; private currentSourceFile: SourceFile = null; @@ -1569,26 +1569,26 @@ module ts { } } - private initialize(filename: string) { + private initialize(fileName: string) { // ensure that both source file and syntax tree are either initialized or not initialized var start = new Date().getTime(); this.hostCache = new HostCache(this.host); this.log("SyntaxTreeCache.Initialize: new HostCache: " + (new Date().getTime() - start)); - var version = this.hostCache.getVersion(filename); + var version = this.hostCache.getVersion(fileName); var sourceFile: SourceFile; - if (this.currentFilename !== filename) { - var scriptSnapshot = this.hostCache.getScriptSnapshot(filename); + if (this.currentFileName !== fileName) { + var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName); var start = new Date().getTime(); - sourceFile = createLanguageServiceSourceFile(filename, scriptSnapshot, ScriptTarget.Latest, version, /*setNodeParents:*/ true); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, ScriptTarget.Latest, version, /*setNodeParents:*/ true); this.log("SyntaxTreeCache.Initialize: createSourceFile: " + (new Date().getTime() - start)); } else if (this.currentFileVersion !== version) { - var scriptSnapshot = this.hostCache.getScriptSnapshot(filename); + var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName); - var editRange = this.hostCache.getChangeRange(filename, this.currentFileVersion, this.currentSourceFile.scriptSnapshot); + var editRange = this.hostCache.getChangeRange(fileName, this.currentFileVersion, this.currentSourceFile.scriptSnapshot); var start = new Date().getTime(); sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); @@ -1598,18 +1598,18 @@ module ts { if (sourceFile) { // All done, ensure state is up to date this.currentFileVersion = version; - this.currentFilename = filename; + this.currentFileName = fileName; this.currentSourceFile = sourceFile; } } - public getCurrentSourceFile(filename: string): SourceFile { - this.initialize(filename); + public getCurrentSourceFile(fileName: string): SourceFile { + this.initialize(fileName); return this.currentSourceFile; } - public getCurrentScriptSnapshot(filename: string): IScriptSnapshot { - return this.getCurrentSourceFile(filename).scriptSnapshot; + public getCurrentScriptSnapshot(fileName: string): IScriptSnapshot { + return this.getCurrentSourceFile(fileName).scriptSnapshot; } } @@ -1618,8 +1618,8 @@ module ts { sourceFile.scriptSnapshot = scriptSnapshot; } - export function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile { - var sourceFile = createSourceFile(filename, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); + export function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile { + var sourceFile = createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); setSourceFileFields(sourceFile, scriptSnapshot, version); // after full parsing we can use table with interned strings as name table sourceFile.nameTable = sourceFile.identifiers; @@ -1663,7 +1663,7 @@ module ts { } // Otherwise, just create a new source file. - return createLanguageServiceSourceFile(sourceFile.filename, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents:*/ true); + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents:*/ true); } export function createDocumentRegistry(): DocumentRegistry { @@ -1704,17 +1704,17 @@ module ts { } function acquireDocument( - filename: string, + fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile { var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); - var entry = lookUp(bucket, filename); + var entry = lookUp(bucket, fileName); if (!entry) { - var sourceFile = createLanguageServiceSourceFile(filename, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); - bucket[filename] = entry = { + bucket[fileName] = entry = { sourceFile: sourceFile, refCount: 0, owners: [] @@ -1727,7 +1727,7 @@ module ts { function updateDocument( sourceFile: SourceFile, - filename: string, + fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, @@ -1736,23 +1736,23 @@ module ts { var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ false); Debug.assert(bucket !== undefined); - var entry = lookUp(bucket, filename); + var entry = lookUp(bucket, fileName); Debug.assert(entry !== undefined); entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, textChangeRange); return entry.sourceFile; } - function releaseDocument(filename: string, compilationSettings: CompilerOptions): void { + function releaseDocument(fileName: string, compilationSettings: CompilerOptions): void { var bucket = getBucketForCompilationSettings(compilationSettings, false); Debug.assert(bucket !== undefined); - var entry = lookUp(bucket, filename); + var entry = lookUp(bucket, fileName); entry.refCount--; Debug.assert(entry.refCount >= 0); if (entry.refCount === 0) { - delete bucket[filename]; + delete bucket[fileName]; } } @@ -1804,7 +1804,7 @@ module ts { var importPath = scanner.getTokenValue(); var pos = scanner.getTokenPos(); importedFiles.push({ - filename: importPath, + fileName: importPath, pos: pos, end: pos + importPath.length }); @@ -1997,7 +1997,7 @@ module ts { // this checker is used to answer all LS questions except errors var typeInfoResolver: TypeChecker; - var useCaseSensitivefilenames = false; + var useCaseSensitivefileNames = false; var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); var activeCompletionSession: CompletionSession; // The current active completion session, used to get the completion entry details @@ -2012,14 +2012,14 @@ module ts { } } - function getCanonicalFileName(filename: string) { - return useCaseSensitivefilenames ? filename : filename.toLowerCase(); + function getCanonicalFileName(fileName: string) { + return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); } - function getValidSourceFile(filename: string): SourceFile { - var sourceFile = program.getSourceFile(getCanonicalFileName(filename)); + function getValidSourceFile(fileName: string): SourceFile { + var sourceFile = program.getSourceFile(getCanonicalFileName(fileName)); if (!sourceFile) { - throw new Error("Could not find file: '" + filename + "'."); + throw new Error("Could not find file: '" + fileName + "'."); } return sourceFile; } @@ -2052,14 +2052,14 @@ module ts { var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; // Now create a new compiler - var newProgram = createProgram(hostCache.getRootFilenames(), newSettings, { + var newProgram = createProgram(hostCache.getRootFileNames(), newSettings, { getSourceFile: getOrCreateSourceFile, getCancellationToken: () => cancellationToken, - getCanonicalFileName: (filename) => useCaseSensitivefilenames ? filename : filename.toLowerCase(), - useCaseSensitiveFileNames: () => useCaseSensitivefilenames, + getCanonicalFileName: (fileName) => useCaseSensitivefileNames ? fileName : fileName.toLowerCase(), + useCaseSensitiveFileNames: () => useCaseSensitivefileNames, getNewLine: () => host.getNewLine ? host.getNewLine() : "\r\n", - getDefaultLibFilename: (options) => host.getDefaultLibFilename(options), - writeFile: (filename, data, writeByteOrderMark) => { }, + getDefaultLibFileName: (options) => host.getDefaultLibFileName(options), + writeFile: (fileName, data, writeByteOrderMark) => { }, getCurrentDirectory: () => host.getCurrentDirectory() }); @@ -2068,9 +2068,9 @@ module ts { if (program) { var oldSourceFiles = program.getSourceFiles(); for (var i = 0, n = oldSourceFiles.length; i < n; i++) { - var filename = oldSourceFiles[i].filename; - if (!newProgram.getSourceFile(filename) || changesInCompilationSettingsAffectSyntax) { - documentRegistry.releaseDocument(filename, oldSettings); + var fileName = oldSourceFiles[i].fileName; + if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { + documentRegistry.releaseDocument(fileName, oldSettings); } } } @@ -2080,13 +2080,13 @@ module ts { return; - function getOrCreateSourceFile(filename: string): SourceFile { + function getOrCreateSourceFile(fileName: string): SourceFile { cancellationToken.throwIfCancellationRequested(); // The program is asking for this file, check first if the host can locate it. // If the host can not locate the file, then it does not exist. return undefined // to the program to allow reporting of errors for missing files. - var hostFileInformation = hostCache.getOrCreateEntry(filename); + var hostFileInformation = hostCache.getOrCreateEntry(fileName); if (!hostFileInformation) { return undefined; } @@ -2097,7 +2097,7 @@ module ts { if (!changesInCompilationSettingsAffectSyntax) { // Check if the old program had this file already - var oldSourceFile = program && program.getSourceFile(filename); + var oldSourceFile = program && program.getSourceFile(fileName); if (oldSourceFile) { // This SourceFile is safe to reuse, return it if (sourceFileUpToDate(oldSourceFile)) { @@ -2105,17 +2105,17 @@ module ts { } // We have an older version of the sourceFile, incrementally parse the changes - var textChangeRange = hostCache.getChangeRange(filename, oldSourceFile.version, oldSourceFile.scriptSnapshot); - return documentRegistry.updateDocument(oldSourceFile, filename, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, textChangeRange); + var textChangeRange = hostCache.getChangeRange(fileName, oldSourceFile.version, oldSourceFile.scriptSnapshot); + return documentRegistry.updateDocument(oldSourceFile, fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, textChangeRange); } } // Could not find this file in the old program, create a new SourceFile for it. - return documentRegistry.acquireDocument(filename, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } function sourceFileUpToDate(sourceFile: SourceFile): boolean { - return sourceFile && sourceFile.version === hostCache.getVersion(sourceFile.filename); + return sourceFile && sourceFile.version === hostCache.getVersion(sourceFile.fileName); } function programUpToDate(): boolean { @@ -2125,14 +2125,14 @@ module ts { } // If number of files in the program do not match, it is not up-to-date - var rootFilenames = hostCache.getRootFilenames(); - if (program.getSourceFiles().length !== rootFilenames.length) { + var rootFileNames = hostCache.getRootFileNames(); + if (program.getSourceFiles().length !== rootFileNames.length) { return false; } // If any file is not up-to-date, then the whole program is not up-to-date - for (var i = 0, n = rootFilenames.length; i < n; i++) { - if (!sourceFileUpToDate(program.getSourceFile(rootFilenames[i]))) { + for (var i = 0, n = rootFileNames.length; i < n; i++) { + if (!sourceFileUpToDate(program.getSourceFile(rootFileNames[i]))) { return false; } } @@ -2162,30 +2162,30 @@ module ts { function dispose(): void { if (program) { forEach(program.getSourceFiles(), - (f) => { documentRegistry.releaseDocument(f.filename, program.getCompilerOptions()); }); + (f) => { documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); }); } } /// Diagnostics - function getSyntacticDiagnostics(filename: string) { + function getSyntacticDiagnostics(fileName: string) { synchronizeHostData(); - filename = normalizeSlashes(filename); + fileName = normalizeSlashes(fileName); - return program.getDiagnostics(getValidSourceFile(filename)); + return program.getDiagnostics(getValidSourceFile(fileName)); } /** * getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors * If '-d' enabled, report both semantic and emitter errors */ - function getSemanticDiagnostics(filename: string) { + function getSemanticDiagnostics(fileName: string) { synchronizeHostData(); - filename = normalizeSlashes(filename) + fileName = normalizeSlashes(fileName) var compilerOptions = program.getCompilerOptions(); var checker = getDiagnosticsProducingTypeChecker(); - var targetSourceFile = getValidSourceFile(filename); + var targetSourceFile = getValidSourceFile(fileName); // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. // Therefore only get diagnostics for given file. @@ -2256,13 +2256,13 @@ module ts { }; } - function getCompletionsAtPosition(filename: string, position: number) { + function getCompletionsAtPosition(fileName: string, position: number) { synchronizeHostData(); - filename = normalizeSlashes(filename); + fileName = normalizeSlashes(fileName); var syntacticStart = new Date().getTime(); - var sourceFile = getValidSourceFile(filename); + var sourceFile = getValidSourceFile(fileName); var start = new Date().getTime(); var currentToken = getTokenAtPosition(sourceFile, position); @@ -2317,7 +2317,7 @@ module ts { // Clear the current activeCompletionSession for this session activeCompletionSession = { - filename: filename, + fileName: fileName, position: position, entries: [], symbols: {}, @@ -2583,17 +2583,17 @@ module ts { } } - function getCompletionEntryDetails(filename: string, position: number, entryName: string): CompletionEntryDetails { + function getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { // Note: No need to call synchronizeHostData, as we have captured all the data we need // in the getCompletionsAtPosition earlier - filename = normalizeSlashes(filename); + fileName = normalizeSlashes(fileName); - var sourceFile = getValidSourceFile(filename); + var sourceFile = getValidSourceFile(fileName); var session = activeCompletionSession; // Ensure that the current active completion session is still valid for this request - if (!session || session.filename !== filename || session.position !== position) { + if (!session || session.fileName !== fileName || session.position !== position) { return undefined; } @@ -2606,7 +2606,7 @@ module ts { // passing the meaning for the node so that we don't report that a suggestion for a value is an interface. // We COULD also just do what 'getSymbolModifiers' does, which is to use the first declaration. Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, location) !== undefined, "Could not find type for symbol"); - var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(filename), location, session.typeChecker, location, SemanticMeaning.All); + var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, session.typeChecker, location, SemanticMeaning.All); return { name: entryName, kind: displayPartsDocumentationsAndSymbolKind.symbolKind, @@ -3149,11 +3149,11 @@ module ts { } /// Goto definition - function getDefinitionAtPosition(filename: string, position: number): DefinitionInfo[] { + function getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { synchronizeHostData(); - filename = normalizeSlashes(filename); - var sourceFile = getValidSourceFile(filename); + fileName = normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); var node = getTouchingPropertyName(sourceFile, position); if (!node) { @@ -3173,10 +3173,10 @@ module ts { var referenceFile = tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { return [{ - fileName: referenceFile.filename, + fileName: referenceFile.fileName, textSpan: createTextSpanFromBounds(0, 0), kind: ScriptElementKind.scriptElement, - name: comment.filename, + name: comment.fileName, containerName: undefined, containerKind: undefined }]; @@ -3229,7 +3229,7 @@ module ts { function getDefinitionInfo(node: Node, symbolKind: string, symbolName: string, containerName: string): DefinitionInfo { return { - fileName: node.getSourceFile().filename, + fileName: node.getSourceFile().fileName, textSpan: createTextSpanFromBounds(node.getStart(), node.getEnd()), kind: symbolKind, name: symbolName, @@ -3285,11 +3285,11 @@ module ts { } /// References and Occurrences - function getOccurrencesAtPosition(filename: string, position: number): ReferenceEntry[] { + function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] { synchronizeHostData(); - filename = normalizeSlashes(filename); - var sourceFile = getValidSourceFile(filename); + fileName = normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); var node = getTouchingWord(sourceFile, position); if (!node) { @@ -3424,7 +3424,7 @@ module ts { if (shouldHighlightNextKeyword) { result.push({ - fileName: filename, + fileName: fileName, textSpan: createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), isWriteAccess: false }); @@ -4152,7 +4152,7 @@ module ts { if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { result.push({ - fileName: sourceFile.filename, + fileName: sourceFile.fileName, textSpan: createTextSpan(position, searchText.length), isWriteAccess: false }); @@ -4537,7 +4537,7 @@ module ts { } return { - fileName: node.getSourceFile().filename, + fileName: node.getSourceFile().fileName, textSpan: createTextSpanFromBounds(start, end), isWriteAccess: isWriteAccess(node) }; @@ -4579,7 +4579,7 @@ module ts { forEach(program.getSourceFiles(), sourceFile => { cancellationToken.throwIfCancellationRequested(); - var filename = sourceFile.filename; + var fileName = sourceFile.fileName; var declarations = sourceFile.getNamedDeclarations(); for (var i = 0, n = declarations.length; i < n; i++) { var declaration = declarations[i]; @@ -4593,7 +4593,7 @@ module ts { kind: getNodeKind(declaration), kindModifiers: getNodeModifiers(declaration), matchKind: MatchKind[matchKind], - fileName: filename, + fileName: fileName, textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), // TODO(jfreeman): What should be the containerName when the container has a computed name? containerName: container && container.name ? (container.name).text : "", @@ -4653,17 +4653,17 @@ module ts { return forEach(diagnostics, diagnostic => diagnostic.category === DiagnosticCategory.Error); } - function getEmitOutput(filename: string): EmitOutput { + function getEmitOutput(fileName: string): EmitOutput { synchronizeHostData(); - filename = normalizeSlashes(filename); - var sourceFile = getValidSourceFile(filename); + fileName = normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); var outputFiles: OutputFile[] = []; - function writeFile(filename: string, data: string, writeByteOrderMark: boolean) { + function writeFile(fileName: string, data: string, writeByteOrderMark: boolean) { outputFiles.push({ - name: filename, + name: fileName, writeByteOrderMark: writeByteOrderMark, text: data }); @@ -4812,16 +4812,16 @@ module ts { } /// Syntactic features - function getCurrentSourceFile(filename: string): SourceFile { - filename = normalizeSlashes(filename); - var currentSourceFile = syntaxTreeCache.getCurrentSourceFile(filename); + function getCurrentSourceFile(fileName: string): SourceFile { + fileName = normalizeSlashes(fileName); + var currentSourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return currentSourceFile; } - function getNameOrDottedNameSpan(filename: string, startPos: number, endPos: number): TextSpan { - filename = ts.normalizeSlashes(filename); + function getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan { + fileName = ts.normalizeSlashes(fileName); // Get node at the location - var node = getTouchingPropertyName(getCurrentSourceFile(filename), startPos); + var node = getTouchingPropertyName(getCurrentSourceFile(fileName), startPos); if (!node) { return; @@ -4873,16 +4873,16 @@ module ts { return createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd()); } - function getBreakpointStatementAtPosition(filename: string, position: number) { + function getBreakpointStatementAtPosition(fileName: string, position: number) { // doesn't use compiler - no need to synchronize with host - filename = ts.normalizeSlashes(filename); - return BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(filename), position); + fileName = ts.normalizeSlashes(fileName); + return BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(fileName), position); } - function getNavigationBarItems(filename: string): NavigationBarItem[] { - filename = normalizeSlashes(filename); + function getNavigationBarItems(fileName: string): NavigationBarItem[] { + fileName = normalizeSlashes(fileName); - return NavigationBar.getNavigationBarItems(getCurrentSourceFile(filename)); + return NavigationBar.getNavigationBarItems(getCurrentSourceFile(fileName)); } function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { @@ -5178,15 +5178,15 @@ module ts { } } - function getOutliningSpans(filename: string): OutliningSpan[] { + function getOutliningSpans(fileName: string): OutliningSpan[] { // doesn't use compiler - no need to synchronize with host - filename = normalizeSlashes(filename); - var sourceFile = getCurrentSourceFile(filename); + fileName = normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); return OutliningElementsCollector.collectElements(sourceFile); } - function getBraceMatchingAtPosition(filename: string, position: number) { - var sourceFile = getCurrentSourceFile(filename); + function getBraceMatchingAtPosition(fileName: string, position: number) { + var sourceFile = getCurrentSourceFile(fileName); var result: TextSpan[] = []; var token = getTouchingToken(sourceFile, position); @@ -5238,11 +5238,11 @@ module ts { } } - function getIndentationAtPosition(filename: string, position: number, editorOptions: EditorOptions) { - filename = normalizeSlashes(filename); + function getIndentationAtPosition(fileName: string, position: number, editorOptions: EditorOptions) { + fileName = normalizeSlashes(fileName); var start = new Date().getTime(); - var sourceFile = getCurrentSourceFile(filename); + var sourceFile = getCurrentSourceFile(fileName); log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); var start = new Date().getTime(); @@ -5284,7 +5284,7 @@ module ts { return []; } - function getTodoComments(filename: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { + function getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { // Note: while getting todo comments seems like a syntactic operation, we actually // treat it as a semantic operation here. This is because we expect our host to call // this on every single file. If we treat this syntactically, then that will cause @@ -5293,9 +5293,9 @@ module ts { // anything away. synchronizeHostData(); - filename = normalizeSlashes(filename); + fileName = normalizeSlashes(fileName); - var sourceFile = getValidSourceFile(filename); + var sourceFile = getValidSourceFile(fileName); cancellationToken.throwIfCancellationRequested(); @@ -5836,7 +5836,7 @@ module ts { export function getDefaultLibFilePath(options: CompilerOptions): string { // Check __dirname is defined and that we are on a node.js system. if (typeof __dirname !== "undefined") { - return __dirname + directorySeparator + getDefaultLibFilename(options); + return __dirname + directorySeparator + getDefaultLibFileName(options); } throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); diff --git a/src/services/shims.ts b/src/services/shims.ts index c9f33914e09f3..c5b2b24108d81 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -51,7 +51,7 @@ module ts { getLocalizedDiagnosticMessages(): string; getCancellationToken(): CancellationToken; getCurrentDirectory(): string; - getDefaultLibFilename(options: string): string; + getDefaultLibFileName(options: string): string; } /// @@ -264,8 +264,8 @@ module ts { return this.shimHost.getCurrentDirectory(); } - public getDefaultLibFilename(options: CompilerOptions): string { - return this.shimHost.getDefaultLibFilename(JSON.stringify(options)); + public getDefaultLibFileName(options: CompilerOptions): string { + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); } } @@ -701,7 +701,7 @@ module ts { forEach(result.referencedFiles, refFile => { convertResult.referencedFiles.push({ - path: normalizePath(refFile.filename), + path: normalizePath(refFile.fileName), position: refFile.pos, length: refFile.end - refFile.pos }); @@ -709,7 +709,7 @@ module ts { forEach(result.importedFiles, importedFile => { convertResult.importedFiles.push({ - path: normalizeSlashes(importedFile.filename), + path: normalizeSlashes(importedFile.fileName), position: importedFile.pos, length: importedFile.end - importedFile.pos }); diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index f1b1a8e8953f8..85d51d2610ff8 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -13,9 +13,9 @@ declare var console: any; import ts = require("typescript"); -export function compile(filenames: string[], options: ts.CompilerOptions): void { +export function compile(fileNames: string[], options: ts.CompilerOptions): void { var host = ts.createCompilerHost(options); - var program = ts.createProgram(filenames, options, host); + var program = ts.createProgram(fileNames, options, host); var checker = ts.createTypeChecker(program, /*produceDiagnostics*/ true); var result = program.emitFiles(); @@ -25,7 +25,7 @@ export function compile(filenames: string[], options: ts.CompilerOptions): void allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(`${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); + console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); }); console.log(`Process exiting with code '${result.emitResultStatus}'.`); @@ -715,7 +715,7 @@ declare module "typescript" { exportName: Identifier; } interface FileReference extends TextRange { - filename: string; + fileName: string; } interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; @@ -723,7 +723,7 @@ declare module "typescript" { interface SourceFile extends Declaration { statements: NodeArray; endOfFileToken: Node; - filename: string; + fileName: string; text: string; amdDependencies: string[]; amdModuleName: string; @@ -738,7 +738,7 @@ declare module "typescript" { } interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; getCurrentDirectory(): string; } interface Program extends ScriptReferenceHost { @@ -788,7 +788,7 @@ declare module "typescript" { getCompilerOptions(): CompilerOptions; getCompilerHost(): CompilerHost; getSourceFiles(): SourceFile[]; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; } interface TypeChecker { getEmitResolver(): EmitResolver; @@ -1201,7 +1201,7 @@ declare module "typescript" { } interface ParsedCommandLine { options: CompilerOptions; - filenames: string[]; + fileNames: string[]; errors: Diagnostic[]; } interface CommandLineOption { @@ -1343,10 +1343,10 @@ declare module "typescript" { isCancellationRequested(): boolean; } interface CompilerHost { - getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; - getDefaultLibFilename(options: CompilerOptions): string; + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getDefaultLibFileName(options: CompilerOptions): string; getCancellationToken?(): CancellationToken; - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; @@ -1413,7 +1413,7 @@ declare module "typescript" { function getSyntacticDiagnostics(sourceFile: SourceFile): Diagnostic[]; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; function isEvalOrArgumentsIdentifier(node: Node): boolean; - function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; function isLeftHandSideExpression(expr: Expression): boolean; function isAssignmentOperator(token: SyntaxKind): boolean; } @@ -1513,7 +1513,7 @@ declare module "typescript" { getLocalizedDiagnosticMessages?(): any; getCancellationToken?(): CancellationToken; getCurrentDirectory(): string; - getDefaultLibFilename(options: CompilerOptions): string; + getDefaultLibFileName(options: CompilerOptions): string; log?(s: string): void; trace?(s: string): void; error?(s: string): void; @@ -1547,7 +1547,7 @@ declare module "typescript" { getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; dispose(): void; } interface ClassifiedSpan { @@ -1783,11 +1783,11 @@ declare module "typescript" { */ interface DocumentRegistry { /** - * Request a stored SourceFile with a given filename and compilationSettings. + * Request a stored SourceFile with a given fileName and compilationSettings. * The first call to acquire will call createLanguageServiceSourceFile to generate * the SourceFile if was not found in the registry. * - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -1796,9 +1796,9 @@ declare module "typescript" { * @parm version Current version of the file. Only used if the file was not found * in the registry and a new one was created. */ - acquireDocument(filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** - * Request an updated version of an already existing SourceFile with a given filename + * Request an updated version of an already existing SourceFile with a given fileName * and compilationSettings. The update will intern call updateLanguageServiceSourceFile * to get an updated SourceFile. * @@ -1806,7 +1806,7 @@ declare module "typescript" { * registry originally. * * @param sourceFile The original sourceFile object to update - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -1817,17 +1817,17 @@ declare module "typescript" { * @parm textChangeRange Change ranges since the last snapshot. Only used if the file * was not found in the registry and a new one was created. */ - updateDocument(sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; /** * Informs the DocumentRegistry that a file is not needed any longer. * * Note: It is not allowed to call release on a SourceFile that was not acquired from * this registry originally. * - * @param filename The name of the file to be released + * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(filename: string, compilationSettings: CompilerOptions): void; + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; } class ScriptElementKind { static unknown: string; @@ -1898,7 +1898,7 @@ declare module "typescript" { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } - function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; var disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; function createDocumentRegistry(): DocumentRegistry; @@ -1921,15 +1921,15 @@ declare module "typescript" { * Please log a "breaking change" issue for any API breaking change affecting this issue */ var ts = require("typescript"); -function compile(filenames, options) { +function compile(fileNames, options) { var host = ts.createCompilerHost(options); - var program = ts.createProgram(filenames, options, host); + var program = ts.createProgram(fileNames, options, host); var checker = ts.createTypeChecker(program, true); var result = program.emitFiles(); var allDiagnostics = program.getDiagnostics().concat(checker.getDiagnostics()).concat(result.diagnostics); allDiagnostics.forEach(function (diagnostic) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(diagnostic.file.filename + " (" + lineChar.line + "," + lineChar.character + "): " + diagnostic.messageText); + console.log(diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + diagnostic.messageText); }); console.log("Process exiting with code '" + result.emitResultStatus + "'."); process.exit(result.emitResultStatus); diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 064170cd70f80..0da89537ce029 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -15,9 +15,9 @@ declare var console: any; import ts = require("typescript"); >ts : typeof ts -export function compile(filenames: string[], options: ts.CompilerOptions): void { ->compile : (filenames: string[], options: ts.CompilerOptions) => void ->filenames : string[] +export function compile(fileNames: string[], options: ts.CompilerOptions): void { +>compile : (fileNames: string[], options: ts.CompilerOptions) => void +>fileNames : string[] >options : ts.CompilerOptions >ts : unknown >CompilerOptions : ts.CompilerOptions @@ -30,13 +30,13 @@ export function compile(filenames: string[], options: ts.CompilerOptions): void >createCompilerHost : (options: ts.CompilerOptions) => ts.CompilerHost >options : ts.CompilerOptions - var program = ts.createProgram(filenames, options, host); + var program = ts.createProgram(fileNames, options, host); >program : ts.Program ->ts.createProgram(filenames, options, host) : ts.Program +>ts.createProgram(fileNames, options, host) : ts.Program >ts.createProgram : (rootNames: string[], options: ts.CompilerOptions, host: ts.CompilerHost) => ts.Program >ts : typeof ts >createProgram : (rootNames: string[], options: ts.CompilerOptions, host: ts.CompilerHost) => ts.Program ->filenames : string[] +>fileNames : string[] >options : ts.CompilerOptions >host : ts.CompilerHost @@ -80,11 +80,11 @@ export function compile(filenames: string[], options: ts.CompilerOptions): void >diagnostics : ts.Diagnostic[] allDiagnostics.forEach(diagnostic => { ->allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); }) : void +>allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); }) : void >allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void >allDiagnostics : ts.Diagnostic[] >forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void ->diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); } : (diagnostic: ts.Diagnostic) => void +>diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); } : (diagnostic: ts.Diagnostic) => void >diagnostic : ts.Diagnostic var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); @@ -99,16 +99,16 @@ export function compile(filenames: string[], options: ts.CompilerOptions): void >diagnostic : ts.Diagnostic >start : number - console.log(`${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); ->console.log(`${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`) : any + console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); +>console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`) : any >console.log : any >console : any >log : any ->diagnostic.file.filename : string +>diagnostic.file.fileName : string >diagnostic.file : ts.SourceFile >diagnostic : ts.Diagnostic >file : ts.SourceFile ->filename : string +>fileName : string >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number @@ -142,7 +142,7 @@ export function compile(filenames: string[], options: ts.CompilerOptions): void compile(process.argv.slice(2), { >compile(process.argv.slice(2), { noEmitOnError: true, noImplicitAny: true, target: ts.ScriptTarget.ES5, module: ts.ModuleKind.CommonJS}) : void ->compile : (filenames: string[], options: ts.CompilerOptions) => void +>compile : (fileNames: string[], options: ts.CompilerOptions) => void >process.argv.slice(2) : any >process.argv.slice : any >process.argv : any @@ -2180,8 +2180,8 @@ declare module "typescript" { >FileReference : FileReference >TextRange : TextRange - filename: string; ->filename : string + fileName: string; +>fileName : string } interface CommentRange extends TextRange { >CommentRange : CommentRange @@ -2203,8 +2203,8 @@ declare module "typescript" { >endOfFileToken : Node >Node : Node - filename: string; ->filename : string + fileName: string; +>fileName : string text: string; >text : string @@ -2250,9 +2250,9 @@ declare module "typescript" { >getCompilerOptions : () => CompilerOptions >CompilerOptions : CompilerOptions - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile getCurrentDirectory(): string; @@ -2408,9 +2408,9 @@ declare module "typescript" { >getSourceFiles : () => SourceFile[] >SourceFile : SourceFile - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile } interface TypeChecker { @@ -3848,8 +3848,8 @@ declare module "typescript" { >options : CompilerOptions >CompilerOptions : CompilerOptions - filenames: string[]; ->filenames : string[] + fileNames: string[]; +>fileNames : string[] errors: Diagnostic[]; >errors : Diagnostic[] @@ -4267,17 +4267,17 @@ declare module "typescript" { interface CompilerHost { >CompilerHost : CompilerHost - getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; ->getSourceFile : (filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile ->filename : string + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; +>getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile +>fileName : string >languageVersion : ScriptTarget >ScriptTarget : ScriptTarget >onError : (message: string) => void >message : string >SourceFile : SourceFile - getDefaultLibFilename(options: CompilerOptions): string; ->getDefaultLibFilename : (options: CompilerOptions) => string + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string >options : CompilerOptions >CompilerOptions : CompilerOptions @@ -4285,9 +4285,9 @@ declare module "typescript" { >getCancellationToken : () => CancellationToken >CancellationToken : CancellationToken - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; ->writeFile : (filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => void ->filename : string + writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; +>writeFile : (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => void +>fileName : string >data : string >writeByteOrderMark : boolean >onError : (message: string) => void @@ -4559,9 +4559,9 @@ declare module "typescript" { >node : Node >Node : Node - function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; ->createSourceFile : (filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile ->filename : string + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile +>fileName : string >sourceText : string >languageVersion : ScriptTarget >ScriptTarget : ScriptTarget @@ -4885,8 +4885,8 @@ declare module "typescript" { getCurrentDirectory(): string; >getCurrentDirectory : () => string - getDefaultLibFilename(options: CompilerOptions): string; ->getDefaultLibFilename : (options: CompilerOptions) => string + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string >options : CompilerOptions >CompilerOptions : CompilerOptions @@ -5075,9 +5075,9 @@ declare module "typescript" { >getProgram : () => Program >Program : Program - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile dispose(): void; @@ -5664,11 +5664,11 @@ declare module "typescript" { >DocumentRegistry : DocumentRegistry /** - * Request a stored SourceFile with a given filename and compilationSettings. + * Request a stored SourceFile with a given fileName and compilationSettings. * The first call to acquire will call createLanguageServiceSourceFile to generate * the SourceFile if was not found in the registry. * - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -5677,9 +5677,9 @@ declare module "typescript" { * @parm version Current version of the file. Only used if the file was not found * in the registry and a new one was created. */ - acquireDocument(filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; ->acquireDocument : (filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile ->filename : string + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot @@ -5688,7 +5688,7 @@ declare module "typescript" { >SourceFile : SourceFile /** - * Request an updated version of an already existing SourceFile with a given filename + * Request an updated version of an already existing SourceFile with a given fileName * and compilationSettings. The update will intern call updateLanguageServiceSourceFile * to get an updated SourceFile. * @@ -5696,7 +5696,7 @@ declare module "typescript" { * registry originally. * * @param sourceFile The original sourceFile object to update - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -5707,11 +5707,11 @@ declare module "typescript" { * @parm textChangeRange Change ranges since the last snapshot. Only used if the file * was not found in the registry and a new one was created. */ - updateDocument(sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; ->updateDocument : (sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile >sourceFile : SourceFile >SourceFile : SourceFile ->filename : string +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot @@ -5727,12 +5727,12 @@ declare module "typescript" { * Note: It is not allowed to call release on a SourceFile that was not acquired from * this registry originally. * - * @param filename The name of the file to be released + * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(filename: string, compilationSettings: CompilerOptions): void; ->releaseDocument : (filename: string, compilationSettings: CompilerOptions) => void ->filename : string + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; +>releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions } @@ -5932,9 +5932,9 @@ declare module "typescript" { throwIfCancellationRequested(): void; >throwIfCancellationRequested : () => void } - function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; ->createLanguageServiceSourceFile : (filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile ->filename : string + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; +>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile +>fileName : string >scriptSnapshot : IScriptSnapshot >IScriptSnapshot : IScriptSnapshot >scriptTarget : ScriptTarget diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index aa12cb40cb32d..c458ad78f7fbe 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -52,14 +52,14 @@ export function delint(sourceFile: ts.SourceFile) { function report(node: ts.Node, message: string) { var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(`${sourceFile.filename} (${lineChar.line},${lineChar.character}): ${message}`) + console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) } } -var filenames = process.argv.slice(2); -filenames.forEach(filename => { +var fileNames = process.argv.slice(2); +fileNames.forEach(fileName => { // Parse a file - var sourceFile = ts.createSourceFile(filename, fs.readFileSync(filename).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); + var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile); @@ -744,7 +744,7 @@ declare module "typescript" { exportName: Identifier; } interface FileReference extends TextRange { - filename: string; + fileName: string; } interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; @@ -752,7 +752,7 @@ declare module "typescript" { interface SourceFile extends Declaration { statements: NodeArray; endOfFileToken: Node; - filename: string; + fileName: string; text: string; amdDependencies: string[]; amdModuleName: string; @@ -767,7 +767,7 @@ declare module "typescript" { } interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; getCurrentDirectory(): string; } interface Program extends ScriptReferenceHost { @@ -817,7 +817,7 @@ declare module "typescript" { getCompilerOptions(): CompilerOptions; getCompilerHost(): CompilerHost; getSourceFiles(): SourceFile[]; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; } interface TypeChecker { getEmitResolver(): EmitResolver; @@ -1230,7 +1230,7 @@ declare module "typescript" { } interface ParsedCommandLine { options: CompilerOptions; - filenames: string[]; + fileNames: string[]; errors: Diagnostic[]; } interface CommandLineOption { @@ -1372,10 +1372,10 @@ declare module "typescript" { isCancellationRequested(): boolean; } interface CompilerHost { - getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; - getDefaultLibFilename(options: CompilerOptions): string; + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getDefaultLibFileName(options: CompilerOptions): string; getCancellationToken?(): CancellationToken; - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; @@ -1442,7 +1442,7 @@ declare module "typescript" { function getSyntacticDiagnostics(sourceFile: SourceFile): Diagnostic[]; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; function isEvalOrArgumentsIdentifier(node: Node): boolean; - function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; function isLeftHandSideExpression(expr: Expression): boolean; function isAssignmentOperator(token: SyntaxKind): boolean; } @@ -1542,7 +1542,7 @@ declare module "typescript" { getLocalizedDiagnosticMessages?(): any; getCancellationToken?(): CancellationToken; getCurrentDirectory(): string; - getDefaultLibFilename(options: CompilerOptions): string; + getDefaultLibFileName(options: CompilerOptions): string; log?(s: string): void; trace?(s: string): void; error?(s: string): void; @@ -1576,7 +1576,7 @@ declare module "typescript" { getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; dispose(): void; } interface ClassifiedSpan { @@ -1812,11 +1812,11 @@ declare module "typescript" { */ interface DocumentRegistry { /** - * Request a stored SourceFile with a given filename and compilationSettings. + * Request a stored SourceFile with a given fileName and compilationSettings. * The first call to acquire will call createLanguageServiceSourceFile to generate * the SourceFile if was not found in the registry. * - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -1825,9 +1825,9 @@ declare module "typescript" { * @parm version Current version of the file. Only used if the file was not found * in the registry and a new one was created. */ - acquireDocument(filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** - * Request an updated version of an already existing SourceFile with a given filename + * Request an updated version of an already existing SourceFile with a given fileName * and compilationSettings. The update will intern call updateLanguageServiceSourceFile * to get an updated SourceFile. * @@ -1835,7 +1835,7 @@ declare module "typescript" { * registry originally. * * @param sourceFile The original sourceFile object to update - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -1846,17 +1846,17 @@ declare module "typescript" { * @parm textChangeRange Change ranges since the last snapshot. Only used if the file * was not found in the registry and a new one was created. */ - updateDocument(sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; /** * Informs the DocumentRegistry that a file is not needed any longer. * * Note: It is not allowed to call release on a SourceFile that was not acquired from * this registry originally. * - * @param filename The name of the file to be released + * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(filename: string, compilationSettings: CompilerOptions): void; + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; } class ScriptElementKind { static unknown: string; @@ -1927,7 +1927,7 @@ declare module "typescript" { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } - function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; var disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; function createDocumentRegistry(): DocumentRegistry; @@ -1982,14 +1982,14 @@ function delint(sourceFile) { } function report(node, message) { var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(sourceFile.filename + " (" + lineChar.line + "," + lineChar.character + "): " + message); + console.log(sourceFile.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + message); } } exports.delint = delint; -var filenames = process.argv.slice(2); -filenames.forEach(function (filename) { +var fileNames = process.argv.slice(2); +fileNames.forEach(function (fileName) { // Parse a file - var sourceFile = ts.createSourceFile(filename, fs.readFileSync(filename).toString(), 2 /* ES6 */, true); + var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), 2 /* ES6 */, true); // delint it delint(sourceFile); }); diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 7065704f422e3..7202e0b4dd6b3 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -235,14 +235,14 @@ export function delint(sourceFile: ts.SourceFile) { >node : ts.Node >getStart : (sourceFile?: ts.SourceFile) => number - console.log(`${sourceFile.filename} (${lineChar.line},${lineChar.character}): ${message}`) ->console.log(`${sourceFile.filename} (${lineChar.line},${lineChar.character}): ${message}`) : any + console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) +>console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) : any >console.log : any >console : any >log : any ->sourceFile.filename : string +>sourceFile.fileName : string >sourceFile : ts.SourceFile ->filename : string +>fileName : string >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number @@ -253,8 +253,8 @@ export function delint(sourceFile: ts.SourceFile) { } } -var filenames = process.argv.slice(2); ->filenames : any +var fileNames = process.argv.slice(2); +>fileNames : any >process.argv.slice(2) : any >process.argv.slice : any >process.argv : any @@ -262,29 +262,29 @@ var filenames = process.argv.slice(2); >argv : any >slice : any -filenames.forEach(filename => { ->filenames.forEach(filename => { // Parse a file var sourceFile = ts.createSourceFile(filename, fs.readFileSync(filename).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);}) : any ->filenames.forEach : any ->filenames : any +fileNames.forEach(fileName => { +>fileNames.forEach(fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);}) : any +>fileNames.forEach : any +>fileNames : any >forEach : any ->filename => { // Parse a file var sourceFile = ts.createSourceFile(filename, fs.readFileSync(filename).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);} : (filename: any) => void ->filename : any +>fileName => { // Parse a file var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile);} : (fileName: any) => void +>fileName : any // Parse a file - var sourceFile = ts.createSourceFile(filename, fs.readFileSync(filename).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); + var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); >sourceFile : ts.SourceFile ->ts.createSourceFile(filename, fs.readFileSync(filename).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true) : ts.SourceFile ->ts.createSourceFile : (filename: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true) : ts.SourceFile +>ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile >ts : typeof ts ->createSourceFile : (filename: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile ->filename : any ->fs.readFileSync(filename).toString() : any ->fs.readFileSync(filename).toString : any ->fs.readFileSync(filename) : any +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>fileName : any +>fs.readFileSync(fileName).toString() : any +>fs.readFileSync(fileName).toString : any +>fs.readFileSync(fileName) : any >fs.readFileSync : any >fs : any >readFileSync : any ->filename : any +>fileName : any >toString : any >ts.ScriptTarget.ES6 : ts.ScriptTarget >ts.ScriptTarget : typeof ts.ScriptTarget @@ -2310,8 +2310,8 @@ declare module "typescript" { >FileReference : FileReference >TextRange : TextRange - filename: string; ->filename : string + fileName: string; +>fileName : string } interface CommentRange extends TextRange { >CommentRange : CommentRange @@ -2333,8 +2333,8 @@ declare module "typescript" { >endOfFileToken : Node >Node : Node - filename: string; ->filename : string + fileName: string; +>fileName : string text: string; >text : string @@ -2380,9 +2380,9 @@ declare module "typescript" { >getCompilerOptions : () => CompilerOptions >CompilerOptions : CompilerOptions - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile getCurrentDirectory(): string; @@ -2538,9 +2538,9 @@ declare module "typescript" { >getSourceFiles : () => SourceFile[] >SourceFile : SourceFile - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile } interface TypeChecker { @@ -3978,8 +3978,8 @@ declare module "typescript" { >options : CompilerOptions >CompilerOptions : CompilerOptions - filenames: string[]; ->filenames : string[] + fileNames: string[]; +>fileNames : string[] errors: Diagnostic[]; >errors : Diagnostic[] @@ -4397,17 +4397,17 @@ declare module "typescript" { interface CompilerHost { >CompilerHost : CompilerHost - getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; ->getSourceFile : (filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile ->filename : string + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; +>getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile +>fileName : string >languageVersion : ScriptTarget >ScriptTarget : ScriptTarget >onError : (message: string) => void >message : string >SourceFile : SourceFile - getDefaultLibFilename(options: CompilerOptions): string; ->getDefaultLibFilename : (options: CompilerOptions) => string + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string >options : CompilerOptions >CompilerOptions : CompilerOptions @@ -4415,9 +4415,9 @@ declare module "typescript" { >getCancellationToken : () => CancellationToken >CancellationToken : CancellationToken - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; ->writeFile : (filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => void ->filename : string + writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; +>writeFile : (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => void +>fileName : string >data : string >writeByteOrderMark : boolean >onError : (message: string) => void @@ -4689,9 +4689,9 @@ declare module "typescript" { >node : Node >Node : Node - function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; ->createSourceFile : (filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile ->filename : string + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile +>fileName : string >sourceText : string >languageVersion : ScriptTarget >ScriptTarget : ScriptTarget @@ -5015,8 +5015,8 @@ declare module "typescript" { getCurrentDirectory(): string; >getCurrentDirectory : () => string - getDefaultLibFilename(options: CompilerOptions): string; ->getDefaultLibFilename : (options: CompilerOptions) => string + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string >options : CompilerOptions >CompilerOptions : CompilerOptions @@ -5205,9 +5205,9 @@ declare module "typescript" { >getProgram : () => Program >Program : Program - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile dispose(): void; @@ -5794,11 +5794,11 @@ declare module "typescript" { >DocumentRegistry : DocumentRegistry /** - * Request a stored SourceFile with a given filename and compilationSettings. + * Request a stored SourceFile with a given fileName and compilationSettings. * The first call to acquire will call createLanguageServiceSourceFile to generate * the SourceFile if was not found in the registry. * - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -5807,9 +5807,9 @@ declare module "typescript" { * @parm version Current version of the file. Only used if the file was not found * in the registry and a new one was created. */ - acquireDocument(filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; ->acquireDocument : (filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile ->filename : string + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot @@ -5818,7 +5818,7 @@ declare module "typescript" { >SourceFile : SourceFile /** - * Request an updated version of an already existing SourceFile with a given filename + * Request an updated version of an already existing SourceFile with a given fileName * and compilationSettings. The update will intern call updateLanguageServiceSourceFile * to get an updated SourceFile. * @@ -5826,7 +5826,7 @@ declare module "typescript" { * registry originally. * * @param sourceFile The original sourceFile object to update - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -5837,11 +5837,11 @@ declare module "typescript" { * @parm textChangeRange Change ranges since the last snapshot. Only used if the file * was not found in the registry and a new one was created. */ - updateDocument(sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; ->updateDocument : (sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile >sourceFile : SourceFile >SourceFile : SourceFile ->filename : string +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot @@ -5857,12 +5857,12 @@ declare module "typescript" { * Note: It is not allowed to call release on a SourceFile that was not acquired from * this registry originally. * - * @param filename The name of the file to be released + * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(filename: string, compilationSettings: CompilerOptions): void; ->releaseDocument : (filename: string, compilationSettings: CompilerOptions) => void ->filename : string + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; +>releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions } @@ -6062,9 +6062,9 @@ declare module "typescript" { throwIfCancellationRequested(): void; >throwIfCancellationRequested : () => void } - function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; ->createLanguageServiceSourceFile : (filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile ->filename : string + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; +>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile +>fileName : string >scriptSnapshot : IScriptSnapshot >IScriptSnapshot : IScriptSnapshot >scriptTarget : ScriptTarget diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 58535e42601ca..c2449b5af678c 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -27,16 +27,16 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { // Create a compilerHost object to allow the compiler to read and write files var compilerHost = { - getSourceFile: (filename, target) => { - return files[filename] !== undefined ? - ts.createSourceFile(filename, files[filename], target) : undefined; + getSourceFile: (fileName, target) => { + return files[fileName] !== undefined ? + ts.createSourceFile(fileName, files[fileName], target) : undefined; }, writeFile: (name, text, writeByteOrderMark) => { outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, - getDefaultLibFilename: () => "lib.d.ts", + getDefaultLibFileName: () => "lib.d.ts", useCaseSensitiveFileNames: () => false, - getCanonicalFileName: (filename) => filename, + getCanonicalFileName: (fileName) => fileName, getCurrentDirectory: () => "", getNewLine: () => "\n" }; @@ -56,7 +56,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { } return { outputs: outputs, - errors: errors.map(function (e) { return e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) + errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) }; } @@ -745,7 +745,7 @@ declare module "typescript" { exportName: Identifier; } interface FileReference extends TextRange { - filename: string; + fileName: string; } interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; @@ -753,7 +753,7 @@ declare module "typescript" { interface SourceFile extends Declaration { statements: NodeArray; endOfFileToken: Node; - filename: string; + fileName: string; text: string; amdDependencies: string[]; amdModuleName: string; @@ -768,7 +768,7 @@ declare module "typescript" { } interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; getCurrentDirectory(): string; } interface Program extends ScriptReferenceHost { @@ -818,7 +818,7 @@ declare module "typescript" { getCompilerOptions(): CompilerOptions; getCompilerHost(): CompilerHost; getSourceFiles(): SourceFile[]; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; } interface TypeChecker { getEmitResolver(): EmitResolver; @@ -1231,7 +1231,7 @@ declare module "typescript" { } interface ParsedCommandLine { options: CompilerOptions; - filenames: string[]; + fileNames: string[]; errors: Diagnostic[]; } interface CommandLineOption { @@ -1373,10 +1373,10 @@ declare module "typescript" { isCancellationRequested(): boolean; } interface CompilerHost { - getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; - getDefaultLibFilename(options: CompilerOptions): string; + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getDefaultLibFileName(options: CompilerOptions): string; getCancellationToken?(): CancellationToken; - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; @@ -1443,7 +1443,7 @@ declare module "typescript" { function getSyntacticDiagnostics(sourceFile: SourceFile): Diagnostic[]; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; function isEvalOrArgumentsIdentifier(node: Node): boolean; - function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; function isLeftHandSideExpression(expr: Expression): boolean; function isAssignmentOperator(token: SyntaxKind): boolean; } @@ -1543,7 +1543,7 @@ declare module "typescript" { getLocalizedDiagnosticMessages?(): any; getCancellationToken?(): CancellationToken; getCurrentDirectory(): string; - getDefaultLibFilename(options: CompilerOptions): string; + getDefaultLibFileName(options: CompilerOptions): string; log?(s: string): void; trace?(s: string): void; error?(s: string): void; @@ -1577,7 +1577,7 @@ declare module "typescript" { getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; dispose(): void; } interface ClassifiedSpan { @@ -1813,11 +1813,11 @@ declare module "typescript" { */ interface DocumentRegistry { /** - * Request a stored SourceFile with a given filename and compilationSettings. + * Request a stored SourceFile with a given fileName and compilationSettings. * The first call to acquire will call createLanguageServiceSourceFile to generate * the SourceFile if was not found in the registry. * - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -1826,9 +1826,9 @@ declare module "typescript" { * @parm version Current version of the file. Only used if the file was not found * in the registry and a new one was created. */ - acquireDocument(filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** - * Request an updated version of an already existing SourceFile with a given filename + * Request an updated version of an already existing SourceFile with a given fileName * and compilationSettings. The update will intern call updateLanguageServiceSourceFile * to get an updated SourceFile. * @@ -1836,7 +1836,7 @@ declare module "typescript" { * registry originally. * * @param sourceFile The original sourceFile object to update - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -1847,17 +1847,17 @@ declare module "typescript" { * @parm textChangeRange Change ranges since the last snapshot. Only used if the file * was not found in the registry and a new one was created. */ - updateDocument(sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; /** * Informs the DocumentRegistry that a file is not needed any longer. * * Note: It is not allowed to call release on a SourceFile that was not acquired from * this registry originally. * - * @param filename The name of the file to be released + * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(filename: string, compilationSettings: CompilerOptions): void; + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; } class ScriptElementKind { static unknown: string; @@ -1928,7 +1928,7 @@ declare module "typescript" { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } - function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; var disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; function createDocumentRegistry(): DocumentRegistry; @@ -1962,15 +1962,15 @@ function transform(contents, compilerOptions) { var outputs = []; // Create a compilerHost object to allow the compiler to read and write files var compilerHost = { - getSourceFile: function (filename, target) { - return files[filename] !== undefined ? ts.createSourceFile(filename, files[filename], target) : undefined; + getSourceFile: function (fileName, target) { + return files[fileName] !== undefined ? ts.createSourceFile(fileName, files[fileName], target) : undefined; }, writeFile: function (name, text, writeByteOrderMark) { outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, - getDefaultLibFilename: function () { return "lib.d.ts"; }, + getDefaultLibFileName: function () { return "lib.d.ts"; }, useCaseSensitiveFileNames: function () { return false; }, - getCanonicalFileName: function (filename) { return filename; }, + getCanonicalFileName: function (fileName) { return fileName; }, getCurrentDirectory: function () { return ""; }, getNewLine: function () { return "\n"; } }; @@ -1989,7 +1989,7 @@ function transform(contents, compilerOptions) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; + return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) }; } diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 5d90818f635c0..9c5de4cccfb33 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -60,32 +60,32 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { // Create a compilerHost object to allow the compiler to read and write files var compilerHost = { ->compilerHost : { getSourceFile: (filename: any, target: any) => ts.SourceFile; writeFile: (name: any, text: any, writeByteOrderMark: any) => void; getDefaultLibFilename: () => string; useCaseSensitiveFileNames: () => boolean; getCanonicalFileName: (filename: any) => any; getCurrentDirectory: () => string; getNewLine: () => string; } ->{ getSourceFile: (filename, target) => { return files[filename] !== undefined ? ts.createSourceFile(filename, files[filename], target) : undefined; }, writeFile: (name, text, writeByteOrderMark) => { outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, getDefaultLibFilename: () => "lib.d.ts", useCaseSensitiveFileNames: () => false, getCanonicalFileName: (filename) => filename, getCurrentDirectory: () => "", getNewLine: () => "\n" } : { getSourceFile: (filename: any, target: any) => ts.SourceFile; writeFile: (name: any, text: any, writeByteOrderMark: any) => void; getDefaultLibFilename: () => string; useCaseSensitiveFileNames: () => boolean; getCanonicalFileName: (filename: any) => any; getCurrentDirectory: () => string; getNewLine: () => string; } +>compilerHost : { getSourceFile: (fileName: any, target: any) => ts.SourceFile; writeFile: (name: any, text: any, writeByteOrderMark: any) => void; getDefaultLibFileName: () => string; useCaseSensitiveFileNames: () => boolean; getCanonicalFileName: (fileName: any) => any; getCurrentDirectory: () => string; getNewLine: () => string; } +>{ getSourceFile: (fileName, target) => { return files[fileName] !== undefined ? ts.createSourceFile(fileName, files[fileName], target) : undefined; }, writeFile: (name, text, writeByteOrderMark) => { outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, getDefaultLibFileName: () => "lib.d.ts", useCaseSensitiveFileNames: () => false, getCanonicalFileName: (fileName) => fileName, getCurrentDirectory: () => "", getNewLine: () => "\n" } : { getSourceFile: (fileName: any, target: any) => ts.SourceFile; writeFile: (name: any, text: any, writeByteOrderMark: any) => void; getDefaultLibFileName: () => string; useCaseSensitiveFileNames: () => boolean; getCanonicalFileName: (fileName: any) => any; getCurrentDirectory: () => string; getNewLine: () => string; } - getSourceFile: (filename, target) => { ->getSourceFile : (filename: any, target: any) => ts.SourceFile ->(filename, target) => { return files[filename] !== undefined ? ts.createSourceFile(filename, files[filename], target) : undefined; } : (filename: any, target: any) => ts.SourceFile ->filename : any + getSourceFile: (fileName, target) => { +>getSourceFile : (fileName: any, target: any) => ts.SourceFile +>(fileName, target) => { return files[fileName] !== undefined ? ts.createSourceFile(fileName, files[fileName], target) : undefined; } : (fileName: any, target: any) => ts.SourceFile +>fileName : any >target : any - return files[filename] !== undefined ? ->files[filename] !== undefined ? ts.createSourceFile(filename, files[filename], target) : undefined : ts.SourceFile ->files[filename] !== undefined : boolean ->files[filename] : any + return files[fileName] !== undefined ? +>files[fileName] !== undefined ? ts.createSourceFile(fileName, files[fileName], target) : undefined : ts.SourceFile +>files[fileName] !== undefined : boolean +>files[fileName] : any >files : { "file.ts": string; "lib.d.ts": any; } ->filename : any +>fileName : any >undefined : undefined - ts.createSourceFile(filename, files[filename], target) : undefined; ->ts.createSourceFile(filename, files[filename], target) : ts.SourceFile ->ts.createSourceFile : (filename: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile + ts.createSourceFile(fileName, files[fileName], target) : undefined; +>ts.createSourceFile(fileName, files[fileName], target) : ts.SourceFile +>ts.createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile >ts : typeof ts ->createSourceFile : (filename: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile ->filename : any ->files[filename] : any +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, setParentNodes?: boolean) => ts.SourceFile +>fileName : any +>files[fileName] : any >files : { "file.ts": string; "lib.d.ts": any; } ->filename : any +>fileName : any >target : any >undefined : undefined @@ -111,19 +111,19 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { >writeByteOrderMark : any }, - getDefaultLibFilename: () => "lib.d.ts", ->getDefaultLibFilename : () => string + getDefaultLibFileName: () => "lib.d.ts", +>getDefaultLibFileName : () => string >() => "lib.d.ts" : () => string useCaseSensitiveFileNames: () => false, >useCaseSensitiveFileNames : () => boolean >() => false : () => boolean - getCanonicalFileName: (filename) => filename, ->getCanonicalFileName : (filename: any) => any ->(filename) => filename : (filename: any) => any ->filename : any ->filename : any + getCanonicalFileName: (fileName) => fileName, +>getCanonicalFileName : (fileName: any) => any +>(fileName) => fileName : (fileName: any) => any +>fileName : any +>fileName : any getCurrentDirectory: () => "", >getCurrentDirectory : () => string @@ -144,7 +144,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { >createProgram : (rootNames: string[], options: ts.CompilerOptions, host: ts.CompilerHost) => ts.Program >["file.ts"] : string[] >compilerOptions : ts.CompilerOptions ->compilerHost : { getSourceFile: (filename: any, target: any) => ts.SourceFile; writeFile: (name: any, text: any, writeByteOrderMark: any) => void; getDefaultLibFilename: () => string; useCaseSensitiveFileNames: () => boolean; getCanonicalFileName: (filename: any) => any; getCurrentDirectory: () => string; getNewLine: () => string; } +>compilerHost : { getSourceFile: (fileName: any, target: any) => ts.SourceFile; writeFile: (name: any, text: any, writeByteOrderMark: any) => void; getDefaultLibFileName: () => string; useCaseSensitiveFileNames: () => boolean; getCanonicalFileName: (fileName: any) => any; getCurrentDirectory: () => string; getNewLine: () => string; } // Query for early errors var errors = program.getDiagnostics(); @@ -185,29 +185,29 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { >emitFiles : (targetSourceFile?: ts.SourceFile) => ts.EmitResult } return { ->{ outputs: outputs, errors: errors.map(function (e) { return e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) } : { outputs: any[]; errors: string[]; } +>{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) } : { outputs: any[]; errors: string[]; } outputs: outputs, >outputs : any[] >outputs : any[] - errors: errors.map(function (e) { return e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) + errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) >errors : string[] ->errors.map(function (e) { return e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) : string[] +>errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) : string[] >errors.map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] >errors : ts.Diagnostic[] >map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] ->function (e) { return e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; } : (e: ts.Diagnostic) => string +>function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; } : (e: ts.Diagnostic) => string >e : ts.Diagnostic ->e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText : string ->e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " : string ->e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line : string ->e.file.filename + "(" : string ->e.file.filename : string +>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText : string +>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " : string +>e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line : string +>e.file.fileName + "(" : string +>e.file.fileName : string >e.file : ts.SourceFile >e : ts.Diagnostic >file : ts.SourceFile ->filename : string +>fileName : string >e.file.getLineAndCharacterFromPosition(e.start).line : number >e.file.getLineAndCharacterFromPosition(e.start) : ts.LineAndCharacter >e.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter @@ -2258,8 +2258,8 @@ declare module "typescript" { >FileReference : FileReference >TextRange : TextRange - filename: string; ->filename : string + fileName: string; +>fileName : string } interface CommentRange extends TextRange { >CommentRange : CommentRange @@ -2281,8 +2281,8 @@ declare module "typescript" { >endOfFileToken : Node >Node : Node - filename: string; ->filename : string + fileName: string; +>fileName : string text: string; >text : string @@ -2328,9 +2328,9 @@ declare module "typescript" { >getCompilerOptions : () => CompilerOptions >CompilerOptions : CompilerOptions - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile getCurrentDirectory(): string; @@ -2486,9 +2486,9 @@ declare module "typescript" { >getSourceFiles : () => SourceFile[] >SourceFile : SourceFile - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile } interface TypeChecker { @@ -3926,8 +3926,8 @@ declare module "typescript" { >options : CompilerOptions >CompilerOptions : CompilerOptions - filenames: string[]; ->filenames : string[] + fileNames: string[]; +>fileNames : string[] errors: Diagnostic[]; >errors : Diagnostic[] @@ -4345,17 +4345,17 @@ declare module "typescript" { interface CompilerHost { >CompilerHost : CompilerHost - getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; ->getSourceFile : (filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile ->filename : string + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; +>getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile +>fileName : string >languageVersion : ScriptTarget >ScriptTarget : ScriptTarget >onError : (message: string) => void >message : string >SourceFile : SourceFile - getDefaultLibFilename(options: CompilerOptions): string; ->getDefaultLibFilename : (options: CompilerOptions) => string + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string >options : CompilerOptions >CompilerOptions : CompilerOptions @@ -4363,9 +4363,9 @@ declare module "typescript" { >getCancellationToken : () => CancellationToken >CancellationToken : CancellationToken - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; ->writeFile : (filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => void ->filename : string + writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; +>writeFile : (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => void +>fileName : string >data : string >writeByteOrderMark : boolean >onError : (message: string) => void @@ -4637,9 +4637,9 @@ declare module "typescript" { >node : Node >Node : Node - function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; ->createSourceFile : (filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile ->filename : string + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile +>fileName : string >sourceText : string >languageVersion : ScriptTarget >ScriptTarget : ScriptTarget @@ -4963,8 +4963,8 @@ declare module "typescript" { getCurrentDirectory(): string; >getCurrentDirectory : () => string - getDefaultLibFilename(options: CompilerOptions): string; ->getDefaultLibFilename : (options: CompilerOptions) => string + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string >options : CompilerOptions >CompilerOptions : CompilerOptions @@ -5153,9 +5153,9 @@ declare module "typescript" { >getProgram : () => Program >Program : Program - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile dispose(): void; @@ -5742,11 +5742,11 @@ declare module "typescript" { >DocumentRegistry : DocumentRegistry /** - * Request a stored SourceFile with a given filename and compilationSettings. + * Request a stored SourceFile with a given fileName and compilationSettings. * The first call to acquire will call createLanguageServiceSourceFile to generate * the SourceFile if was not found in the registry. * - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -5755,9 +5755,9 @@ declare module "typescript" { * @parm version Current version of the file. Only used if the file was not found * in the registry and a new one was created. */ - acquireDocument(filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; ->acquireDocument : (filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile ->filename : string + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot @@ -5766,7 +5766,7 @@ declare module "typescript" { >SourceFile : SourceFile /** - * Request an updated version of an already existing SourceFile with a given filename + * Request an updated version of an already existing SourceFile with a given fileName * and compilationSettings. The update will intern call updateLanguageServiceSourceFile * to get an updated SourceFile. * @@ -5774,7 +5774,7 @@ declare module "typescript" { * registry originally. * * @param sourceFile The original sourceFile object to update - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -5785,11 +5785,11 @@ declare module "typescript" { * @parm textChangeRange Change ranges since the last snapshot. Only used if the file * was not found in the registry and a new one was created. */ - updateDocument(sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; ->updateDocument : (sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile >sourceFile : SourceFile >SourceFile : SourceFile ->filename : string +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot @@ -5805,12 +5805,12 @@ declare module "typescript" { * Note: It is not allowed to call release on a SourceFile that was not acquired from * this registry originally. * - * @param filename The name of the file to be released + * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(filename: string, compilationSettings: CompilerOptions): void; ->releaseDocument : (filename: string, compilationSettings: CompilerOptions) => void ->filename : string + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; +>releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions } @@ -6010,9 +6010,9 @@ declare module "typescript" { throwIfCancellationRequested(): void; >throwIfCancellationRequested : () => void } - function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; ->createLanguageServiceSourceFile : (filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile ->filename : string + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; +>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile +>fileName : string >scriptSnapshot : IScriptSnapshot >IScriptSnapshot : IScriptSnapshot >scriptTarget : ScriptTarget diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index cd8b44bfe2db2..5167674d375f9 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -15,40 +15,40 @@ declare var path: any; import ts = require("typescript"); -function watch(rootFilenames: string[], options: ts.CompilerOptions) { +function watch(rootFileNames: string[], options: ts.CompilerOptions) { var files: ts.Map<{ version: number }> = {}; // initialize the list of files - rootFilenames.forEach(filename => { - files[filename] = { version: 0 }; + rootFileNames.forEach(fileName => { + files[fileName] = { version: 0 }; }); // Create the language service host to allow the LS to communicate with the host var servicesHost: ts.LanguageServiceHost = { - getScriptFileNames: () => rootFilenames, - getScriptVersion: (filename) => files[filename] && files[filename].version.toString(), - getScriptSnapshot: (filename) => { - if (!fs.existsSync(filename)) { + getScriptFileNames: () => rootFileNames, + getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), + getScriptSnapshot: (fileName) => { + if (!fs.existsSync(fileName)) { return undefined; } - return ts.ScriptSnapshot.fromString(fs.readFileSync(filename).toString()); + return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); }, getCurrentDirectory: () => process.cwd(), getCompilationSettings: () => options, - getDefaultLibFilename: (options) => ts.getDefaultLibFilePath(options), + getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), }; // Create the language service files var services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()) // Now let's watch the files - rootFilenames.forEach(filename => { + rootFileNames.forEach(fileName => { // First time around, emit all files - emitFile(filename); + emitFile(fileName); // Add a watch on the file to handle next change - fs.watchFile(filename, + fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp @@ -57,22 +57,22 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { } // Update the version to signal a change in the file - files[filename].version++; + files[fileName].version++; // write the changes to disk - emitFile(filename); + emitFile(fileName); }); }); - function emitFile(filename: string) { - var output = services.getEmitOutput(filename); + function emitFile(fileName: string) { + var output = services.getEmitOutput(fileName); if (output.emitOutputStatus === ts.EmitReturnStatus.Succeeded) { - console.log(`Emitting ${filename}`); + console.log(`Emitting ${fileName}`); } else { - console.log(`Emitting ${filename} failed`); - logErrors(filename); + console.log(`Emitting ${fileName} failed`); + logErrors(fileName); } output.outputFiles.forEach(o => { @@ -80,15 +80,15 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { }); } - function logErrors(filename: string) { + function logErrors(fileName: string) { var allDiagnostics = services.getCompilerOptionsDiagnostics() - .concat(services.getSyntacticDiagnostics(filename)) - .concat(services.getSemanticDiagnostics(filename)); + .concat(services.getSyntacticDiagnostics(fileName)) + .concat(services.getSemanticDiagnostics(fileName)); allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(` Error ${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); } else { console.log(` Error: ${diagnostic.messageText}`); @@ -99,7 +99,7 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { // Initialize files constituting the program as all .ts files in the current directory var currentDirectoryFiles = fs.readdirSync(process.cwd()). - filter(filename=> filename.length >= 3 && filename.substr(filename.length - 3, 3) === ".ts"); + filter(fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"); // Start the watcher watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }); @@ -782,7 +782,7 @@ declare module "typescript" { exportName: Identifier; } interface FileReference extends TextRange { - filename: string; + fileName: string; } interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; @@ -790,7 +790,7 @@ declare module "typescript" { interface SourceFile extends Declaration { statements: NodeArray; endOfFileToken: Node; - filename: string; + fileName: string; text: string; amdDependencies: string[]; amdModuleName: string; @@ -805,7 +805,7 @@ declare module "typescript" { } interface ScriptReferenceHost { getCompilerOptions(): CompilerOptions; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; getCurrentDirectory(): string; } interface Program extends ScriptReferenceHost { @@ -855,7 +855,7 @@ declare module "typescript" { getCompilerOptions(): CompilerOptions; getCompilerHost(): CompilerHost; getSourceFiles(): SourceFile[]; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; } interface TypeChecker { getEmitResolver(): EmitResolver; @@ -1268,7 +1268,7 @@ declare module "typescript" { } interface ParsedCommandLine { options: CompilerOptions; - filenames: string[]; + fileNames: string[]; errors: Diagnostic[]; } interface CommandLineOption { @@ -1410,10 +1410,10 @@ declare module "typescript" { isCancellationRequested(): boolean; } interface CompilerHost { - getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; - getDefaultLibFilename(options: CompilerOptions): string; + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getDefaultLibFileName(options: CompilerOptions): string; getCancellationToken?(): CancellationToken; - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; + writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; @@ -1480,7 +1480,7 @@ declare module "typescript" { function getSyntacticDiagnostics(sourceFile: SourceFile): Diagnostic[]; function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; function isEvalOrArgumentsIdentifier(node: Node): boolean; - function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; function isLeftHandSideExpression(expr: Expression): boolean; function isAssignmentOperator(token: SyntaxKind): boolean; } @@ -1580,7 +1580,7 @@ declare module "typescript" { getLocalizedDiagnosticMessages?(): any; getCancellationToken?(): CancellationToken; getCurrentDirectory(): string; - getDefaultLibFilename(options: CompilerOptions): string; + getDefaultLibFileName(options: CompilerOptions): string; log?(s: string): void; trace?(s: string): void; error?(s: string): void; @@ -1614,7 +1614,7 @@ declare module "typescript" { getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; - getSourceFile(filename: string): SourceFile; + getSourceFile(fileName: string): SourceFile; dispose(): void; } interface ClassifiedSpan { @@ -1850,11 +1850,11 @@ declare module "typescript" { */ interface DocumentRegistry { /** - * Request a stored SourceFile with a given filename and compilationSettings. + * Request a stored SourceFile with a given fileName and compilationSettings. * The first call to acquire will call createLanguageServiceSourceFile to generate * the SourceFile if was not found in the registry. * - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -1863,9 +1863,9 @@ declare module "typescript" { * @parm version Current version of the file. Only used if the file was not found * in the registry and a new one was created. */ - acquireDocument(filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; /** - * Request an updated version of an already existing SourceFile with a given filename + * Request an updated version of an already existing SourceFile with a given fileName * and compilationSettings. The update will intern call updateLanguageServiceSourceFile * to get an updated SourceFile. * @@ -1873,7 +1873,7 @@ declare module "typescript" { * registry originally. * * @param sourceFile The original sourceFile object to update - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -1884,17 +1884,17 @@ declare module "typescript" { * @parm textChangeRange Change ranges since the last snapshot. Only used if the file * was not found in the registry and a new one was created. */ - updateDocument(sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; /** * Informs the DocumentRegistry that a file is not needed any longer. * * Note: It is not allowed to call release on a SourceFile that was not acquired from * this registry originally. * - * @param filename The name of the file to be released + * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(filename: string, compilationSettings: CompilerOptions): void; + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; } class ScriptElementKind { static unknown: string; @@ -1965,7 +1965,7 @@ declare module "typescript" { isCancellationRequested(): boolean; throwIfCancellationRequested(): void; } - function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; var disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; function createDocumentRegistry(): DocumentRegistry; @@ -1988,63 +1988,63 @@ declare module "typescript" { * Please log a "breaking change" issue for any API breaking change affecting this issue */ var ts = require("typescript"); -function watch(rootFilenames, options) { +function watch(rootFileNames, options) { var files = {}; // initialize the list of files - rootFilenames.forEach(function (filename) { - files[filename] = { version: 0 }; + rootFileNames.forEach(function (fileName) { + files[fileName] = { version: 0 }; }); // Create the language service host to allow the LS to communicate with the host var servicesHost = { - getScriptFileNames: function () { return rootFilenames; }, - getScriptVersion: function (filename) { return files[filename] && files[filename].version.toString(); }, - getScriptSnapshot: function (filename) { - if (!fs.existsSync(filename)) { + getScriptFileNames: function () { return rootFileNames; }, + getScriptVersion: function (fileName) { return files[fileName] && files[fileName].version.toString(); }, + getScriptSnapshot: function (fileName) { + if (!fs.existsSync(fileName)) { return undefined; } - return ts.ScriptSnapshot.fromString(fs.readFileSync(filename).toString()); + return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); }, getCurrentDirectory: function () { return process.cwd(); }, getCompilationSettings: function () { return options; }, - getDefaultLibFilename: function (options) { return ts.getDefaultLibFilePath(options); } + getDefaultLibFileName: function (options) { return ts.getDefaultLibFilePath(options); } }; // Create the language service files var services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); // Now let's watch the files - rootFilenames.forEach(function (filename) { + rootFileNames.forEach(function (fileName) { // First time around, emit all files - emitFile(filename); + emitFile(fileName); // Add a watch on the file to handle next change - fs.watchFile(filename, { persistent: true, interval: 250 }, function (curr, prev) { + fs.watchFile(fileName, { persistent: true, interval: 250 }, function (curr, prev) { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file - files[filename].version++; + files[fileName].version++; // write the changes to disk - emitFile(filename); + emitFile(fileName); }); }); - function emitFile(filename) { - var output = services.getEmitOutput(filename); + function emitFile(fileName) { + var output = services.getEmitOutput(fileName); if (output.emitOutputStatus === 0 /* Succeeded */) { - console.log("Emitting " + filename); + console.log("Emitting " + fileName); } else { - console.log("Emitting " + filename + " failed"); - logErrors(filename); + console.log("Emitting " + fileName + " failed"); + logErrors(fileName); } output.outputFiles.forEach(function (o) { fs.writeFileSync(o.name, o.text, "utf8"); }); } - function logErrors(filename) { - var allDiagnostics = services.getCompilerOptionsDiagnostics().concat(services.getSyntacticDiagnostics(filename)).concat(services.getSemanticDiagnostics(filename)); + function logErrors(fileName) { + var allDiagnostics = services.getCompilerOptionsDiagnostics().concat(services.getSyntacticDiagnostics(fileName)).concat(services.getSemanticDiagnostics(fileName)); allDiagnostics.forEach(function (diagnostic) { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(" Error " + diagnostic.file.filename + " (" + lineChar.line + "," + lineChar.character + "): " + diagnostic.messageText); + console.log(" Error " + diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + diagnostic.messageText); } else { console.log(" Error: " + diagnostic.messageText); @@ -2053,6 +2053,6 @@ function watch(rootFilenames, options) { } } // Initialize files constituting the program as all .ts files in the current directory -var currentDirectoryFiles = fs.readdirSync(process.cwd()).filter(function (filename) { return filename.length >= 3 && filename.substr(filename.length - 3, 3) === ".ts"; }); +var currentDirectoryFiles = fs.readdirSync(process.cwd()).filter(function (fileName) { return fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"; }); // Start the watcher watch(currentDirectoryFiles, { module: 1 /* CommonJS */ }); diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 7050f0497d9ab..583b6c4fc8fc1 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -21,9 +21,9 @@ declare var path: any; import ts = require("typescript"); >ts : typeof ts -function watch(rootFilenames: string[], options: ts.CompilerOptions) { ->watch : (rootFilenames: string[], options: ts.CompilerOptions) => void ->rootFilenames : string[] +function watch(rootFileNames: string[], options: ts.CompilerOptions) { +>watch : (rootFileNames: string[], options: ts.CompilerOptions) => void +>rootFileNames : string[] >options : ts.CompilerOptions >ts : unknown >CompilerOptions : ts.CompilerOptions @@ -36,19 +36,19 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { >{} : { [x: string]: undefined; } // initialize the list of files - rootFilenames.forEach(filename => { ->rootFilenames.forEach(filename => { files[filename] = { version: 0 }; }) : void ->rootFilenames.forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void ->rootFilenames : string[] + rootFileNames.forEach(fileName => { +>rootFileNames.forEach(fileName => { files[fileName] = { version: 0 }; }) : void +>rootFileNames.forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void +>rootFileNames : string[] >forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void ->filename => { files[filename] = { version: 0 }; } : (filename: string) => void ->filename : string +>fileName => { files[fileName] = { version: 0 }; } : (fileName: string) => void +>fileName : string - files[filename] = { version: 0 }; ->files[filename] = { version: 0 } : { version: number; } ->files[filename] : { version: number; } + files[fileName] = { version: 0 }; +>files[fileName] = { version: 0 } : { version: number; } +>files[fileName] : { version: number; } >files : ts.Map<{ version: number; }> ->filename : string +>fileName : string >{ version: 0 } : { version: number; } >version : number @@ -59,61 +59,61 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { >servicesHost : ts.LanguageServiceHost >ts : unknown >LanguageServiceHost : ts.LanguageServiceHost ->{ getScriptFileNames: () => rootFilenames, getScriptVersion: (filename) => files[filename] && files[filename].version.toString(), getScriptSnapshot: (filename) => { if (!fs.existsSync(filename)) { return undefined; } return ts.ScriptSnapshot.fromString(fs.readFileSync(filename).toString()); }, getCurrentDirectory: () => process.cwd(), getCompilationSettings: () => options, getDefaultLibFilename: (options) => ts.getDefaultLibFilePath(options), } : { getScriptFileNames: () => string[]; getScriptVersion: (filename: string) => string; getScriptSnapshot: (filename: string) => ts.IScriptSnapshot; getCurrentDirectory: () => any; getCompilationSettings: () => ts.CompilerOptions; getDefaultLibFilename: (options: ts.CompilerOptions) => string; } +>{ getScriptFileNames: () => rootFileNames, getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), getScriptSnapshot: (fileName) => { if (!fs.existsSync(fileName)) { return undefined; } return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); }, getCurrentDirectory: () => process.cwd(), getCompilationSettings: () => options, getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), } : { getScriptFileNames: () => string[]; getScriptVersion: (fileName: string) => string; getScriptSnapshot: (fileName: string) => ts.IScriptSnapshot; getCurrentDirectory: () => any; getCompilationSettings: () => ts.CompilerOptions; getDefaultLibFileName: (options: ts.CompilerOptions) => string; } - getScriptFileNames: () => rootFilenames, + getScriptFileNames: () => rootFileNames, >getScriptFileNames : () => string[] ->() => rootFilenames : () => string[] ->rootFilenames : string[] - - getScriptVersion: (filename) => files[filename] && files[filename].version.toString(), ->getScriptVersion : (filename: string) => string ->(filename) => files[filename] && files[filename].version.toString() : (filename: string) => string ->filename : string ->files[filename] && files[filename].version.toString() : string ->files[filename] : { version: number; } +>() => rootFileNames : () => string[] +>rootFileNames : string[] + + getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), +>getScriptVersion : (fileName: string) => string +>(fileName) => files[fileName] && files[fileName].version.toString() : (fileName: string) => string +>fileName : string +>files[fileName] && files[fileName].version.toString() : string +>files[fileName] : { version: number; } >files : ts.Map<{ version: number; }> ->filename : string ->files[filename].version.toString() : string ->files[filename].version.toString : (radix?: number) => string ->files[filename].version : number ->files[filename] : { version: number; } +>fileName : string +>files[fileName].version.toString() : string +>files[fileName].version.toString : (radix?: number) => string +>files[fileName].version : number +>files[fileName] : { version: number; } >files : ts.Map<{ version: number; }> ->filename : string +>fileName : string >version : number >toString : (radix?: number) => string - getScriptSnapshot: (filename) => { ->getScriptSnapshot : (filename: string) => ts.IScriptSnapshot ->(filename) => { if (!fs.existsSync(filename)) { return undefined; } return ts.ScriptSnapshot.fromString(fs.readFileSync(filename).toString()); } : (filename: string) => ts.IScriptSnapshot ->filename : string + getScriptSnapshot: (fileName) => { +>getScriptSnapshot : (fileName: string) => ts.IScriptSnapshot +>(fileName) => { if (!fs.existsSync(fileName)) { return undefined; } return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); } : (fileName: string) => ts.IScriptSnapshot +>fileName : string - if (!fs.existsSync(filename)) { ->!fs.existsSync(filename) : boolean ->fs.existsSync(filename) : any + if (!fs.existsSync(fileName)) { +>!fs.existsSync(fileName) : boolean +>fs.existsSync(fileName) : any >fs.existsSync : any >fs : any >existsSync : any ->filename : string +>fileName : string return undefined; >undefined : undefined } - return ts.ScriptSnapshot.fromString(fs.readFileSync(filename).toString()); ->ts.ScriptSnapshot.fromString(fs.readFileSync(filename).toString()) : ts.IScriptSnapshot + return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); +>ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()) : ts.IScriptSnapshot >ts.ScriptSnapshot.fromString : (text: string) => ts.IScriptSnapshot >ts.ScriptSnapshot : typeof ts.ScriptSnapshot >ts : typeof ts >ScriptSnapshot : typeof ts.ScriptSnapshot >fromString : (text: string) => ts.IScriptSnapshot ->fs.readFileSync(filename).toString() : any ->fs.readFileSync(filename).toString : any ->fs.readFileSync(filename) : any +>fs.readFileSync(fileName).toString() : any +>fs.readFileSync(fileName).toString : any +>fs.readFileSync(fileName) : any >fs.readFileSync : any >fs : any >readFileSync : any ->filename : string +>fileName : string >toString : any }, @@ -130,8 +130,8 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { >() => options : () => ts.CompilerOptions >options : ts.CompilerOptions - getDefaultLibFilename: (options) => ts.getDefaultLibFilePath(options), ->getDefaultLibFilename : (options: ts.CompilerOptions) => string + getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), +>getDefaultLibFileName : (options: ts.CompilerOptions) => string >(options) => ts.getDefaultLibFilePath(options) : (options: ts.CompilerOptions) => string >options : ts.CompilerOptions >ts.getDefaultLibFilePath(options) : string @@ -156,27 +156,27 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { >createDocumentRegistry : () => ts.DocumentRegistry // Now let's watch the files - rootFilenames.forEach(filename => { ->rootFilenames.forEach(filename => { // First time around, emit all files emitFile(filename); // Add a watch on the file to handle next change fs.watchFile(filename, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[filename].version++; // write the changes to disk emitFile(filename); }); }) : void ->rootFilenames.forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void ->rootFilenames : string[] + rootFileNames.forEach(fileName => { +>rootFileNames.forEach(fileName => { // First time around, emit all files emitFile(fileName); // Add a watch on the file to handle next change fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); }); }) : void +>rootFileNames.forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void +>rootFileNames : string[] >forEach : (callbackfn: (value: string, index: number, array: string[]) => void, thisArg?: any) => void ->filename => { // First time around, emit all files emitFile(filename); // Add a watch on the file to handle next change fs.watchFile(filename, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[filename].version++; // write the changes to disk emitFile(filename); }); } : (filename: string) => void ->filename : string +>fileName => { // First time around, emit all files emitFile(fileName); // Add a watch on the file to handle next change fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); }); } : (fileName: string) => void +>fileName : string // First time around, emit all files - emitFile(filename); ->emitFile(filename) : void ->emitFile : (filename: string) => void ->filename : string + emitFile(fileName); +>emitFile(fileName) : void +>emitFile : (fileName: string) => void +>fileName : string // Add a watch on the file to handle next change - fs.watchFile(filename, ->fs.watchFile(filename, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[filename].version++; // write the changes to disk emitFile(filename); }) : any + fs.watchFile(fileName, +>fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); }) : any >fs.watchFile : any >fs : any >watchFile : any ->filename : string +>fileName : string { persistent: true, interval: 250 }, >{ persistent: true, interval: 250 } : { persistent: boolean; interval: number; } @@ -184,7 +184,7 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { >interval : number (curr, prev) => { ->(curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[filename].version++; // write the changes to disk emitFile(filename); } : (curr: any, prev: any) => void +>(curr, prev) => { // Check timestamp if (+curr.mtime <= +prev.mtime) { return; } // Update the version to signal a change in the file files[fileName].version++; // write the changes to disk emitFile(fileName); } : (curr: any, prev: any) => void >curr : any >prev : any @@ -204,34 +204,34 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { } // Update the version to signal a change in the file - files[filename].version++; ->files[filename].version++ : number ->files[filename].version : number ->files[filename] : { version: number; } + files[fileName].version++; +>files[fileName].version++ : number +>files[fileName].version : number +>files[fileName] : { version: number; } >files : ts.Map<{ version: number; }> ->filename : string +>fileName : string >version : number // write the changes to disk - emitFile(filename); ->emitFile(filename) : void ->emitFile : (filename: string) => void ->filename : string + emitFile(fileName); +>emitFile(fileName) : void +>emitFile : (fileName: string) => void +>fileName : string }); }); - function emitFile(filename: string) { ->emitFile : (filename: string) => void ->filename : string + function emitFile(fileName: string) { +>emitFile : (fileName: string) => void +>fileName : string - var output = services.getEmitOutput(filename); + var output = services.getEmitOutput(fileName); >output : ts.EmitOutput ->services.getEmitOutput(filename) : ts.EmitOutput +>services.getEmitOutput(fileName) : ts.EmitOutput >services.getEmitOutput : (fileName: string) => ts.EmitOutput >services : ts.LanguageService >getEmitOutput : (fileName: string) => ts.EmitOutput ->filename : string +>fileName : string if (output.emitOutputStatus === ts.EmitReturnStatus.Succeeded) { >output.emitOutputStatus === ts.EmitReturnStatus.Succeeded : boolean @@ -244,25 +244,25 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { >EmitReturnStatus : typeof ts.EmitReturnStatus >Succeeded : ts.EmitReturnStatus - console.log(`Emitting ${filename}`); ->console.log(`Emitting ${filename}`) : any + console.log(`Emitting ${fileName}`); +>console.log(`Emitting ${fileName}`) : any >console.log : any >console : any >log : any ->filename : string +>fileName : string } else { - console.log(`Emitting ${filename} failed`); ->console.log(`Emitting ${filename} failed`) : any + console.log(`Emitting ${fileName} failed`); +>console.log(`Emitting ${fileName} failed`) : any >console.log : any >console : any >log : any ->filename : string +>fileName : string - logErrors(filename); ->logErrors(filename) : void ->logErrors : (filename: string) => void ->filename : string + logErrors(fileName); +>logErrors(fileName) : void +>logErrors : (fileName: string) => void +>fileName : string } output.outputFiles.forEach(o => { @@ -290,43 +290,43 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { }); } - function logErrors(filename: string) { ->logErrors : (filename: string) => void ->filename : string + function logErrors(fileName: string) { +>logErrors : (fileName: string) => void +>fileName : string var allDiagnostics = services.getCompilerOptionsDiagnostics() >allDiagnostics : ts.Diagnostic[] ->services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(filename)) .concat(services.getSemanticDiagnostics(filename)) : ts.Diagnostic[] ->services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(filename)) .concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } ->services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(filename)) : ts.Diagnostic[] +>services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) .concat(services.getSemanticDiagnostics(fileName)) : ts.Diagnostic[] +>services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) .concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } +>services.getCompilerOptionsDiagnostics() .concat(services.getSyntacticDiagnostics(fileName)) : ts.Diagnostic[] >services.getCompilerOptionsDiagnostics() .concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } >services.getCompilerOptionsDiagnostics() : ts.Diagnostic[] >services.getCompilerOptionsDiagnostics : () => ts.Diagnostic[] >services : ts.LanguageService >getCompilerOptionsDiagnostics : () => ts.Diagnostic[] - .concat(services.getSyntacticDiagnostics(filename)) + .concat(services.getSyntacticDiagnostics(fileName)) >concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } ->services.getSyntacticDiagnostics(filename) : ts.Diagnostic[] +>services.getSyntacticDiagnostics(fileName) : ts.Diagnostic[] >services.getSyntacticDiagnostics : (fileName: string) => ts.Diagnostic[] >services : ts.LanguageService >getSyntacticDiagnostics : (fileName: string) => ts.Diagnostic[] ->filename : string +>fileName : string - .concat(services.getSemanticDiagnostics(filename)); + .concat(services.getSemanticDiagnostics(fileName)); >concat : { (...items: U[]): ts.Diagnostic[]; (...items: ts.Diagnostic[]): ts.Diagnostic[]; } ->services.getSemanticDiagnostics(filename) : ts.Diagnostic[] +>services.getSemanticDiagnostics(fileName) : ts.Diagnostic[] >services.getSemanticDiagnostics : (fileName: string) => ts.Diagnostic[] >services : ts.LanguageService >getSemanticDiagnostics : (fileName: string) => ts.Diagnostic[] ->filename : string +>fileName : string allDiagnostics.forEach(diagnostic => { ->allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void +>allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void >allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void >allDiagnostics : ts.Diagnostic[] >forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void ->diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void +>diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void >diagnostic : ts.Diagnostic if (diagnostic.file) { @@ -346,16 +346,16 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { >diagnostic : ts.Diagnostic >start : number - console.log(` Error ${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); ->console.log(` Error ${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`) : any + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); +>console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`) : any >console.log : any >console : any >log : any ->diagnostic.file.filename : string +>diagnostic.file.fileName : string >diagnostic.file : ts.SourceFile >diagnostic : ts.Diagnostic >file : ts.SourceFile ->filename : string +>fileName : string >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number @@ -383,7 +383,7 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { // Initialize files constituting the program as all .ts files in the current directory var currentDirectoryFiles = fs.readdirSync(process.cwd()). >currentDirectoryFiles : any ->fs.readdirSync(process.cwd()). filter(filename=> filename.length >= 3 && filename.substr(filename.length - 3, 3) === ".ts") : any +>fs.readdirSync(process.cwd()). filter(fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts") : any >fs.readdirSync(process.cwd()). filter : any >fs.readdirSync(process.cwd()) : any >fs.readdirSync : any @@ -394,29 +394,29 @@ var currentDirectoryFiles = fs.readdirSync(process.cwd()). >process : any >cwd : any - filter(filename=> filename.length >= 3 && filename.substr(filename.length - 3, 3) === ".ts"); + filter(fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"); >filter : any ->filename=> filename.length >= 3 && filename.substr(filename.length - 3, 3) === ".ts" : (filename: any) => boolean ->filename : any ->filename.length >= 3 && filename.substr(filename.length - 3, 3) === ".ts" : boolean ->filename.length >= 3 : boolean ->filename.length : any ->filename : any +>fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts" : (fileName: any) => boolean +>fileName : any +>fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts" : boolean +>fileName.length >= 3 : boolean +>fileName.length : any +>fileName : any >length : any ->filename.substr(filename.length - 3, 3) === ".ts" : boolean ->filename.substr(filename.length - 3, 3) : any ->filename.substr : any ->filename : any +>fileName.substr(fileName.length - 3, 3) === ".ts" : boolean +>fileName.substr(fileName.length - 3, 3) : any +>fileName.substr : any +>fileName : any >substr : any ->filename.length - 3 : number ->filename.length : any ->filename : any +>fileName.length - 3 : number +>fileName.length : any +>fileName : any >length : any // Start the watcher watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }); >watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }) : void ->watch : (rootFilenames: string[], options: ts.CompilerOptions) => void +>watch : (rootFileNames: string[], options: ts.CompilerOptions) => void >currentDirectoryFiles : any >{ module: ts.ModuleKind.CommonJS } : { [x: string]: ts.ModuleKind; module: ts.ModuleKind; } >module : ts.ModuleKind @@ -2436,8 +2436,8 @@ declare module "typescript" { >FileReference : FileReference >TextRange : TextRange - filename: string; ->filename : string + fileName: string; +>fileName : string } interface CommentRange extends TextRange { >CommentRange : CommentRange @@ -2459,8 +2459,8 @@ declare module "typescript" { >endOfFileToken : Node >Node : Node - filename: string; ->filename : string + fileName: string; +>fileName : string text: string; >text : string @@ -2506,9 +2506,9 @@ declare module "typescript" { >getCompilerOptions : () => CompilerOptions >CompilerOptions : CompilerOptions - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile getCurrentDirectory(): string; @@ -2664,9 +2664,9 @@ declare module "typescript" { >getSourceFiles : () => SourceFile[] >SourceFile : SourceFile - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile } interface TypeChecker { @@ -4104,8 +4104,8 @@ declare module "typescript" { >options : CompilerOptions >CompilerOptions : CompilerOptions - filenames: string[]; ->filenames : string[] + fileNames: string[]; +>fileNames : string[] errors: Diagnostic[]; >errors : Diagnostic[] @@ -4523,17 +4523,17 @@ declare module "typescript" { interface CompilerHost { >CompilerHost : CompilerHost - getSourceFile(filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; ->getSourceFile : (filename: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile ->filename : string + getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; +>getSourceFile : (fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void) => SourceFile +>fileName : string >languageVersion : ScriptTarget >ScriptTarget : ScriptTarget >onError : (message: string) => void >message : string >SourceFile : SourceFile - getDefaultLibFilename(options: CompilerOptions): string; ->getDefaultLibFilename : (options: CompilerOptions) => string + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string >options : CompilerOptions >CompilerOptions : CompilerOptions @@ -4541,9 +4541,9 @@ declare module "typescript" { >getCancellationToken : () => CancellationToken >CancellationToken : CancellationToken - writeFile(filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; ->writeFile : (filename: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => void ->filename : string + writeFile(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; +>writeFile : (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void) => void +>fileName : string >data : string >writeByteOrderMark : boolean >onError : (message: string) => void @@ -4815,9 +4815,9 @@ declare module "typescript" { >node : Node >Node : Node - function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; ->createSourceFile : (filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile ->filename : string + function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; +>createSourceFile : (fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean) => SourceFile +>fileName : string >sourceText : string >languageVersion : ScriptTarget >ScriptTarget : ScriptTarget @@ -5141,8 +5141,8 @@ declare module "typescript" { getCurrentDirectory(): string; >getCurrentDirectory : () => string - getDefaultLibFilename(options: CompilerOptions): string; ->getDefaultLibFilename : (options: CompilerOptions) => string + getDefaultLibFileName(options: CompilerOptions): string; +>getDefaultLibFileName : (options: CompilerOptions) => string >options : CompilerOptions >CompilerOptions : CompilerOptions @@ -5331,9 +5331,9 @@ declare module "typescript" { >getProgram : () => Program >Program : Program - getSourceFile(filename: string): SourceFile; ->getSourceFile : (filename: string) => SourceFile ->filename : string + getSourceFile(fileName: string): SourceFile; +>getSourceFile : (fileName: string) => SourceFile +>fileName : string >SourceFile : SourceFile dispose(): void; @@ -5920,11 +5920,11 @@ declare module "typescript" { >DocumentRegistry : DocumentRegistry /** - * Request a stored SourceFile with a given filename and compilationSettings. + * Request a stored SourceFile with a given fileName and compilationSettings. * The first call to acquire will call createLanguageServiceSourceFile to generate * the SourceFile if was not found in the registry. * - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -5933,9 +5933,9 @@ declare module "typescript" { * @parm version Current version of the file. Only used if the file was not found * in the registry and a new one was created. */ - acquireDocument(filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; ->acquireDocument : (filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile ->filename : string + acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string): SourceFile; +>acquireDocument : (fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string) => SourceFile +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot @@ -5944,7 +5944,7 @@ declare module "typescript" { >SourceFile : SourceFile /** - * Request an updated version of an already existing SourceFile with a given filename + * Request an updated version of an already existing SourceFile with a given fileName * and compilationSettings. The update will intern call updateLanguageServiceSourceFile * to get an updated SourceFile. * @@ -5952,7 +5952,7 @@ declare module "typescript" { * registry originally. * * @param sourceFile The original sourceFile object to update - * @param filename The name of the file requested + * @param fileName The name of the file requested * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. @@ -5963,11 +5963,11 @@ declare module "typescript" { * @parm textChangeRange Change ranges since the last snapshot. Only used if the file * was not found in the registry and a new one was created. */ - updateDocument(sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; ->updateDocument : (sourceFile: SourceFile, filename: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile + updateDocument(sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; +>updateDocument : (sourceFile: SourceFile, fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange) => SourceFile >sourceFile : SourceFile >SourceFile : SourceFile ->filename : string +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions >scriptSnapshot : IScriptSnapshot @@ -5983,12 +5983,12 @@ declare module "typescript" { * Note: It is not allowed to call release on a SourceFile that was not acquired from * this registry originally. * - * @param filename The name of the file to be released + * @param fileName The name of the file to be released * @param compilationSettings The compilation settings used to acquire the file */ - releaseDocument(filename: string, compilationSettings: CompilerOptions): void; ->releaseDocument : (filename: string, compilationSettings: CompilerOptions) => void ->filename : string + releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; +>releaseDocument : (fileName: string, compilationSettings: CompilerOptions) => void +>fileName : string >compilationSettings : CompilerOptions >CompilerOptions : CompilerOptions } @@ -6188,9 +6188,9 @@ declare module "typescript" { throwIfCancellationRequested(): void; >throwIfCancellationRequested : () => void } - function createLanguageServiceSourceFile(filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; ->createLanguageServiceSourceFile : (filename: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile ->filename : string + function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; +>createLanguageServiceSourceFile : (fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean) => SourceFile +>fileName : string >scriptSnapshot : IScriptSnapshot >IScriptSnapshot : IScriptSnapshot >scriptTarget : ScriptTarget diff --git a/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline b/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline index 4b89414059cdb..111448faa6110 100644 --- a/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline +++ b/tests/baselines/reference/getEmitOutputDeclarationMultiFiles.baseline @@ -1,12 +1,12 @@ EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile1.js +FileName : tests/cases/fourslash/inputFile1.js var x = 5; var Bar = (function () { function Bar() { } return Bar; })(); -Filename : tests/cases/fourslash/inputFile1.d.ts +FileName : tests/cases/fourslash/inputFile1.d.ts declare var x: number; declare class Bar { x: string; @@ -14,14 +14,14 @@ declare class Bar { } EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile2.js +FileName : tests/cases/fourslash/inputFile2.js var x1 = "hello world"; var Foo = (function () { function Foo() { } return Foo; })(); -Filename : tests/cases/fourslash/inputFile2.d.ts +FileName : tests/cases/fourslash/inputFile2.d.ts declare var x1: string; declare class Foo { x: string; diff --git a/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline b/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline index 545c37a0728f2..a54108eb37925 100644 --- a/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline +++ b/tests/baselines/reference/getEmitOutputDeclarationSingleFile.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : Succeeded -Filename : declSingleFile.js +FileName : declSingleFile.js var x = 5; var Bar = (function () { function Bar() { @@ -12,7 +12,7 @@ var Foo = (function () { } return Foo; })(); -Filename : declSingleFile.d.ts +FileName : declSingleFile.d.ts declare var x: number; declare class Bar { x: string; diff --git a/tests/baselines/reference/getEmitOutputExternalModule.baseline b/tests/baselines/reference/getEmitOutputExternalModule.baseline index 33360cbed61de..6c1b0552a49f5 100644 --- a/tests/baselines/reference/getEmitOutputExternalModule.baseline +++ b/tests/baselines/reference/getEmitOutputExternalModule.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : Succeeded -Filename : declSingleFile.js +FileName : declSingleFile.js var x = 5; var Bar = (function () { function Bar() { diff --git a/tests/baselines/reference/getEmitOutputExternalModule2.baseline b/tests/baselines/reference/getEmitOutputExternalModule2.baseline index ede5474d8cccb..5613592b4145d 100644 --- a/tests/baselines/reference/getEmitOutputExternalModule2.baseline +++ b/tests/baselines/reference/getEmitOutputExternalModule2.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : JSGeneratedWithSemanticErrors -Filename : declSingleFile.js +FileName : declSingleFile.js var x = 5; var Bar = (function () { function Bar() { diff --git a/tests/baselines/reference/getEmitOutputMapRoots.baseline b/tests/baselines/reference/getEmitOutputMapRoots.baseline index 93dab28e6fcb8..733897879df4e 100644 --- a/tests/baselines/reference/getEmitOutputMapRoots.baseline +++ b/tests/baselines/reference/getEmitOutputMapRoots.baseline @@ -1,6 +1,6 @@ EmitOutputStatus : Succeeded -Filename : declSingleFile.js.map -{"version":3,"file":"declSingleFile.js","sourceRoot":"","sources":["../tests/cases/fourslash/inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : declSingleFile.js +FileName : declSingleFile.js.map +{"version":3,"file":"declSingleFile.js","sourceRoot":"","sources":["../tests/cases/fourslash/inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : declSingleFile.js var x = 109; var foo = "hello world"; var M = (function () { diff --git a/tests/baselines/reference/getEmitOutputNoErrors.baseline b/tests/baselines/reference/getEmitOutputNoErrors.baseline index 47ba14353194d..b8eddab6a9c0e 100644 --- a/tests/baselines/reference/getEmitOutputNoErrors.baseline +++ b/tests/baselines/reference/getEmitOutputNoErrors.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile.js +FileName : tests/cases/fourslash/inputFile.js var x; var M = (function () { function M() { diff --git a/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline b/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline index 1f61d57c81ee8..6be2d3e1d0451 100644 --- a/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline +++ b/tests/baselines/reference/getEmitOutputOnlyOneFile.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile2.js +FileName : tests/cases/fourslash/inputFile2.js var x; var Foo = (function () { function Foo() { diff --git a/tests/baselines/reference/getEmitOutputSingleFile.baseline b/tests/baselines/reference/getEmitOutputSingleFile.baseline index dd8f2be8079f1..b5fc4214d7c43 100644 --- a/tests/baselines/reference/getEmitOutputSingleFile.baseline +++ b/tests/baselines/reference/getEmitOutputSingleFile.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : Succeeded -Filename : outputDir/singleFile.js +FileName : outputDir/singleFile.js var x; var Bar = (function () { function Bar() { diff --git a/tests/baselines/reference/getEmitOutputSingleFile2.baseline b/tests/baselines/reference/getEmitOutputSingleFile2.baseline index 2f5dbe3daf875..fcbd145361d20 100644 --- a/tests/baselines/reference/getEmitOutputSingleFile2.baseline +++ b/tests/baselines/reference/getEmitOutputSingleFile2.baseline @@ -1,8 +1,8 @@ EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile3.js +FileName : tests/cases/fourslash/inputFile3.js exports.foo = 10; exports.bar = "hello world"; -Filename : tests/cases/fourslash/inputFile3.d.ts +FileName : tests/cases/fourslash/inputFile3.d.ts export declare var foo: number; export declare var bar: string; diff --git a/tests/baselines/reference/getEmitOutputSourceMap.baseline b/tests/baselines/reference/getEmitOutputSourceMap.baseline index 75ee2a266179d..c095c2f754269 100644 --- a/tests/baselines/reference/getEmitOutputSourceMap.baseline +++ b/tests/baselines/reference/getEmitOutputSourceMap.baseline @@ -1,6 +1,6 @@ EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile.js.map -{"version":3,"file":"inputFile.js","sourceRoot":"","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile.js +FileName : tests/cases/fourslash/inputFile.js.map +{"version":3,"file":"inputFile.js","sourceRoot":"","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile.js var x = 109; var foo = "hello world"; var M = (function () { diff --git a/tests/baselines/reference/getEmitOutputSourceMap2.baseline b/tests/baselines/reference/getEmitOutputSourceMap2.baseline index 2c132d8cd6601..021b391871240 100644 --- a/tests/baselines/reference/getEmitOutputSourceMap2.baseline +++ b/tests/baselines/reference/getEmitOutputSourceMap2.baseline @@ -1,6 +1,6 @@ EmitOutputStatus : Succeeded -Filename : sample/outDir/inputFile1.js.map -{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : sample/outDir/inputFile1.js +FileName : sample/outDir/inputFile1.js.map +{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : sample/outDir/inputFile1.js var x = 109; var foo = "hello world"; var M = (function () { @@ -10,8 +10,8 @@ var M = (function () { })(); //# sourceMappingURL=inputFile1.js.map EmitOutputStatus : Succeeded -Filename : sample/outDir/inputFile2.js.map -{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile2.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,aAAa,CAAC;AAC1B,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,GAAG,EAAE,CAAC;AACd,CAAC"}Filename : sample/outDir/inputFile2.js +FileName : sample/outDir/inputFile2.js.map +{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["../../tests/cases/fourslash/inputFile2.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,aAAa,CAAC;AAC1B,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,GAAG,EAAE,CAAC;AACd,CAAC"}FileName : sample/outDir/inputFile2.js var intro = "hello world"; if (intro !== undefined) { var k = 10; diff --git a/tests/baselines/reference/getEmitOutputSourceRoot.baseline b/tests/baselines/reference/getEmitOutputSourceRoot.baseline index 9252163165b17..38621490fe736 100644 --- a/tests/baselines/reference/getEmitOutputSourceRoot.baseline +++ b/tests/baselines/reference/getEmitOutputSourceRoot.baseline @@ -1,6 +1,6 @@ EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile.js.map -{"version":3,"file":"inputFile.js","sourceRoot":"sourceRootDir/","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile.js +FileName : tests/cases/fourslash/inputFile.js.map +{"version":3,"file":"inputFile.js","sourceRoot":"sourceRootDir/","sources":["inputFile.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile.js var x = 109; var foo = "hello world"; var M = (function () { diff --git a/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline b/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline index 5c26a1920f9f7..46e8a782a97bf 100644 --- a/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline +++ b/tests/baselines/reference/getEmitOutputSourceRootMultiFiles.baseline @@ -1,6 +1,6 @@ EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile1.js.map -{"version":3,"file":"inputFile1.js","sourceRoot":"sourceRootDir/","sources":["inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile1.js +FileName : tests/cases/fourslash/inputFile1.js.map +{"version":3,"file":"inputFile1.js","sourceRoot":"sourceRootDir/","sources":["inputFile1.ts"],"names":["M","M.constructor"],"mappings":"AAAA,IAAI,CAAC,GAAG,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,aAAa,CAAC;AACxB,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile1.js var x = 109; var foo = "hello world"; var M = (function () { @@ -10,8 +10,8 @@ var M = (function () { })(); //# sourceMappingURL=inputFile1.js.map EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile2.js.map -{"version":3,"file":"inputFile2.js","sourceRoot":"sourceRootDir/","sources":["inputFile2.ts"],"names":["C","C.constructor"],"mappings":"AAAA,IAAI,GAAG,GAAG,wBAAwB,CAAC;AACnC,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}Filename : tests/cases/fourslash/inputFile2.js +FileName : tests/cases/fourslash/inputFile2.js.map +{"version":3,"file":"inputFile2.js","sourceRoot":"sourceRootDir/","sources":["inputFile2.ts"],"names":["C","C.constructor"],"mappings":"AAAA,IAAI,GAAG,GAAG,wBAAwB,CAAC;AACnC,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAGPC,CAACA;IAADD,QAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile2.js var bar = "hello world Typescript"; var C = (function () { function C() { diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline index be0ac935601c5..51ea0ffba1a54 100644 --- a/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile.baseline @@ -1,7 +1,7 @@ EmitOutputStatus : Succeeded EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile2.js +FileName : tests/cases/fourslash/inputFile2.js var x1 = "hello world"; var Foo = (function () { function Foo() { diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline index 92a1ea1fe7a59..c42cf8974cbe2 100644 --- a/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile2.baseline @@ -1,7 +1,7 @@ EmitOutputStatus : Succeeded EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile2.js +FileName : tests/cases/fourslash/inputFile2.js var Foo = (function () { function Foo() { } @@ -10,6 +10,6 @@ var Foo = (function () { exports.Foo = Foo; EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile3.js +FileName : tests/cases/fourslash/inputFile3.js var x = "hello"; diff --git a/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline b/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline index f960a05f151b0..83837faece88c 100644 --- a/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline +++ b/tests/baselines/reference/getEmitOutputWithDeclarationFile3.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : Succeeded -Filename : declSingle.js +FileName : declSingle.js var x = "hello"; var x1 = 1000; diff --git a/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline b/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline index 889902d98a263..e38f6a2021c93 100644 --- a/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline +++ b/tests/baselines/reference/getEmitOutputWithEarlySyntacticErrors.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : JSGeneratedWithSemanticErrors -Filename : tests/cases/fourslash/inputFile1.js +FileName : tests/cases/fourslash/inputFile1.js // File contains early errors. All outputs should be skipped. const uninitialized_const_error; diff --git a/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline b/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline index f16e381059203..359faef5fc1f3 100644 --- a/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline +++ b/tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : EmitErrorsEncountered -Filename : tests/cases/fourslash/inputFile.js +FileName : tests/cases/fourslash/inputFile.js var M; (function (M) { var C = (function () { diff --git a/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline b/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline index 4befff0466ced..2465f832b37af 100644 --- a/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline +++ b/tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : EmitErrorsEncountered -Filename : tests/cases/fourslash/inputFile.js +FileName : tests/cases/fourslash/inputFile.js define(["require", "exports"], function (require, exports) { var C = (function () { function C() { diff --git a/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline b/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline index fed9a4d208936..a1a721704a30a 100644 --- a/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline +++ b/tests/baselines/reference/getEmitOutputWithSemanticErrors.baseline @@ -1,4 +1,4 @@ EmitOutputStatus : JSGeneratedWithSemanticErrors -Filename : tests/cases/fourslash/inputFile.js +FileName : tests/cases/fourslash/inputFile.js var x = "hello world"; diff --git a/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline b/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline index a2e296b85e292..d9cf2b1eeddd1 100644 --- a/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline +++ b/tests/baselines/reference/getEmitOutputWithSemanticErrors2.baseline @@ -1,4 +1,4 @@ EmitOutputStatus : DeclarationGenerationSkipped -Filename : tests/cases/fourslash/inputFile.js +FileName : tests/cases/fourslash/inputFile.js var x = "hello world"; diff --git a/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles.baseline b/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles.baseline index c6396314824d8..9186504542060 100644 --- a/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles.baseline +++ b/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles.baseline @@ -1,8 +1,8 @@ EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile1.js +FileName : tests/cases/fourslash/inputFile1.js // File to emit, does not contain semantic errors // expected to be emitted correctelly regardless of the semantic errors in the other file var noErrors = true; -Filename : tests/cases/fourslash/inputFile1.d.ts +FileName : tests/cases/fourslash/inputFile1.d.ts declare var noErrors: boolean; diff --git a/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles2.baseline b/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles2.baseline index 41b16b40e6551..8b3a8ce852620 100644 --- a/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles2.baseline +++ b/tests/baselines/reference/getEmitOutputWithSemanticErrorsForMultipleFiles2.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : DeclarationGenerationSkipped -Filename : out.js +FileName : out.js // File to emit, does not contain semantic errors, but --out is passed // expected to not generate declarations because of the semantic errors in the other file var noErrors = true; diff --git a/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline b/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline index bf27703890b84..0edb4e3bb61c4 100644 --- a/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline +++ b/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile1.js +FileName : tests/cases/fourslash/inputFile1.js // File to emit, does not contain syntactic errors // expected to be emitted correctelly regardless of the syntactic errors in the other file var noErrors = true; diff --git a/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles2.baseline b/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles2.baseline index e1ed630f2f46c..21f60cf9eeb1e 100644 --- a/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles2.baseline +++ b/tests/baselines/reference/getEmitOutputWithSyntacticErrorsForMultipleFiles2.baseline @@ -1,5 +1,5 @@ EmitOutputStatus : Succeeded -Filename : out.js +FileName : out.js // File to emit, does not contain syntactic errors, but --out is passed // expected to not generate outputs because of the syntactic errors in the other file. var noErrors = true; diff --git a/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline b/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline index 3353e1b9b9f6f..53c09d5fe28d8 100644 --- a/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline +++ b/tests/baselines/reference/getEmitOutputWithSyntaxErrors.baseline @@ -1,4 +1,4 @@ EmitOutputStatus : Succeeded -Filename : tests/cases/fourslash/inputFile.js +FileName : tests/cases/fourslash/inputFile.js var x; diff --git a/tests/cases/compiler/APISample_compile.ts b/tests/cases/compiler/APISample_compile.ts index 004e22dcb0ccb..757574c0d7d13 100644 --- a/tests/cases/compiler/APISample_compile.ts +++ b/tests/cases/compiler/APISample_compile.ts @@ -13,9 +13,9 @@ declare var console: any; import ts = require("typescript"); -export function compile(filenames: string[], options: ts.CompilerOptions): void { +export function compile(fileNames: string[], options: ts.CompilerOptions): void { var host = ts.createCompilerHost(options); - var program = ts.createProgram(filenames, options, host); + var program = ts.createProgram(fileNames, options, host); var checker = ts.createTypeChecker(program, /*produceDiagnostics*/ true); var result = program.emitFiles(); @@ -25,7 +25,7 @@ export function compile(filenames: string[], options: ts.CompilerOptions): void allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(`${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); + console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); }); console.log(`Process exiting with code '${result.emitResultStatus}'.`); diff --git a/tests/cases/compiler/APISample_linter.ts b/tests/cases/compiler/APISample_linter.ts index 1942923a81d92..c95d6273d4ec6 100644 --- a/tests/cases/compiler/APISample_linter.ts +++ b/tests/cases/compiler/APISample_linter.ts @@ -52,14 +52,14 @@ export function delint(sourceFile: ts.SourceFile) { function report(node: ts.Node, message: string) { var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(`${sourceFile.filename} (${lineChar.line},${lineChar.character}): ${message}`) + console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) } } -var filenames = process.argv.slice(2); -filenames.forEach(filename => { +var fileNames = process.argv.slice(2); +fileNames.forEach(fileName => { // Parse a file - var sourceFile = ts.createSourceFile(filename, fs.readFileSync(filename).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); + var sourceFile = ts.createSourceFile(fileName, fs.readFileSync(fileName).toString(), ts.ScriptTarget.ES6, /*setParentNodes */ true); // delint it delint(sourceFile); diff --git a/tests/cases/compiler/APISample_transform.ts b/tests/cases/compiler/APISample_transform.ts index b0a6c7d37eaf2..c3e214b0e37b9 100644 --- a/tests/cases/compiler/APISample_transform.ts +++ b/tests/cases/compiler/APISample_transform.ts @@ -27,16 +27,16 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { // Create a compilerHost object to allow the compiler to read and write files var compilerHost = { - getSourceFile: (filename, target) => { - return files[filename] !== undefined ? - ts.createSourceFile(filename, files[filename], target) : undefined; + getSourceFile: (fileName, target) => { + return files[fileName] !== undefined ? + ts.createSourceFile(fileName, files[fileName], target) : undefined; }, writeFile: (name, text, writeByteOrderMark) => { outputs.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); }, - getDefaultLibFilename: () => "lib.d.ts", + getDefaultLibFileName: () => "lib.d.ts", useCaseSensitiveFileNames: () => false, - getCanonicalFileName: (filename) => filename, + getCanonicalFileName: (fileName) => fileName, getCurrentDirectory: () => "", getNewLine: () => "\n" }; @@ -56,7 +56,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { } return { outputs: outputs, - errors: errors.map(function (e) { return e.file.filename + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) + errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + e.messageText; }) }; } diff --git a/tests/cases/compiler/APISample_watcher.ts b/tests/cases/compiler/APISample_watcher.ts index 3c65b59801d1d..f29e72604d51d 100644 --- a/tests/cases/compiler/APISample_watcher.ts +++ b/tests/cases/compiler/APISample_watcher.ts @@ -15,40 +15,40 @@ declare var path: any; import ts = require("typescript"); -function watch(rootFilenames: string[], options: ts.CompilerOptions) { +function watch(rootFileNames: string[], options: ts.CompilerOptions) { var files: ts.Map<{ version: number }> = {}; // initialize the list of files - rootFilenames.forEach(filename => { - files[filename] = { version: 0 }; + rootFileNames.forEach(fileName => { + files[fileName] = { version: 0 }; }); // Create the language service host to allow the LS to communicate with the host var servicesHost: ts.LanguageServiceHost = { - getScriptFileNames: () => rootFilenames, - getScriptVersion: (filename) => files[filename] && files[filename].version.toString(), - getScriptSnapshot: (filename) => { - if (!fs.existsSync(filename)) { + getScriptFileNames: () => rootFileNames, + getScriptVersion: (fileName) => files[fileName] && files[fileName].version.toString(), + getScriptSnapshot: (fileName) => { + if (!fs.existsSync(fileName)) { return undefined; } - return ts.ScriptSnapshot.fromString(fs.readFileSync(filename).toString()); + return ts.ScriptSnapshot.fromString(fs.readFileSync(fileName).toString()); }, getCurrentDirectory: () => process.cwd(), getCompilationSettings: () => options, - getDefaultLibFilename: (options) => ts.getDefaultLibFilePath(options), + getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), }; // Create the language service files var services = ts.createLanguageService(servicesHost, ts.createDocumentRegistry()) // Now let's watch the files - rootFilenames.forEach(filename => { + rootFileNames.forEach(fileName => { // First time around, emit all files - emitFile(filename); + emitFile(fileName); // Add a watch on the file to handle next change - fs.watchFile(filename, + fs.watchFile(fileName, { persistent: true, interval: 250 }, (curr, prev) => { // Check timestamp @@ -57,22 +57,22 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { } // Update the version to signal a change in the file - files[filename].version++; + files[fileName].version++; // write the changes to disk - emitFile(filename); + emitFile(fileName); }); }); - function emitFile(filename: string) { - var output = services.getEmitOutput(filename); + function emitFile(fileName: string) { + var output = services.getEmitOutput(fileName); if (output.emitOutputStatus === ts.EmitReturnStatus.Succeeded) { - console.log(`Emitting ${filename}`); + console.log(`Emitting ${fileName}`); } else { - console.log(`Emitting ${filename} failed`); - logErrors(filename); + console.log(`Emitting ${fileName} failed`); + logErrors(fileName); } output.outputFiles.forEach(o => { @@ -80,15 +80,15 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { }); } - function logErrors(filename: string) { + function logErrors(fileName: string) { var allDiagnostics = services.getCompilerOptionsDiagnostics() - .concat(services.getSyntacticDiagnostics(filename)) - .concat(services.getSemanticDiagnostics(filename)); + .concat(services.getSyntacticDiagnostics(fileName)) + .concat(services.getSemanticDiagnostics(fileName)); allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(` Error ${diagnostic.file.filename} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${diagnostic.messageText}`); } else { console.log(` Error: ${diagnostic.messageText}`); @@ -99,7 +99,7 @@ function watch(rootFilenames: string[], options: ts.CompilerOptions) { // Initialize files constituting the program as all .ts files in the current directory var currentDirectoryFiles = fs.readdirSync(process.cwd()). - filter(filename=> filename.length >= 3 && filename.substr(filename.length - 3, 3) === ".ts"); + filter(fileName=> fileName.length >= 3 && fileName.substr(fileName.length - 3, 3) === ".ts"); // Start the watcher watch(currentDirectoryFiles, { module: ts.ModuleKind.CommonJS }); \ No newline at end of file diff --git a/tests/cases/unittests/incrementalParser.ts b/tests/cases/unittests/incrementalParser.ts index 97809b86daed0..1b5e1a665ab88 100644 --- a/tests/cases/unittests/incrementalParser.ts +++ b/tests/cases/unittests/incrementalParser.ts @@ -68,8 +68,8 @@ module ts { // There should be no reused nodes between two trees that are fully parsed. assert.isTrue(reusedElements(oldTree, newTree) === 0); - assert.equal(newTree.filename, incrementalNewTree.filename, "newTree.filename !== incrementalNewTree.filename"); - assert.equal(newTree.text, incrementalNewTree.text, "newTree.filename !== incrementalNewTree.filename"); + assert.equal(newTree.fileName, incrementalNewTree.fileName, "newTree.fileName !== incrementalNewTree.fileName"); + assert.equal(newTree.text, incrementalNewTree.text, "newTree.text !== incrementalNewTree.text"); if (expectedReusedElements !== -1) { var actualReusedCount = reusedElements(oldTree, incrementalNewTree); @@ -781,7 +781,7 @@ module m3 { }\ " }\r\n" + " \r\n" + " return {\r\n" + - " getEmitOutput: (filename): Bar => null,\r\n" + + " getEmitOutput: (fileName): Bar => null,\r\n" + " };\r\n" + " }"; diff --git a/tests/cases/unittests/services/preProcessFile.ts b/tests/cases/unittests/services/preProcessFile.ts index 88aa0f5e9edd8..e0d397838e049 100644 --- a/tests/cases/unittests/services/preProcessFile.ts +++ b/tests/cases/unittests/services/preProcessFile.ts @@ -25,7 +25,7 @@ describe('PreProcessFile:', function () { var resultImportedFile = resultImportedFiles[i]; var expectedImportedFile = expectedImportedFiles[i]; - assert.equal(resultImportedFile.filename, expectedImportedFile.filename, "Imported file path does not match expected. Expected: " + expectedImportedFile.filename + ". Actual: " + resultImportedFile.filename + "."); + assert.equal(resultImportedFile.fileName, expectedImportedFile.fileName, "Imported file path does not match expected. Expected: " + expectedImportedFile.fileName + ". Actual: " + resultImportedFile.fileName + "."); assert.equal(resultImportedFile.pos, expectedImportedFile.pos, "Imported file position does not match expected. Expected: " + expectedImportedFile.pos + ". Actual: " + resultImportedFile.pos + "."); @@ -36,7 +36,7 @@ describe('PreProcessFile:', function () { var resultReferencedFile = resultReferencedFiles[i]; var expectedReferencedFile = expectedReferencedFiles[i]; - assert.equal(resultReferencedFile.filename, expectedReferencedFile.filename, "Referenced file path does not match expected. Expected: " + expectedReferencedFile.filename + ". Actual: " + resultReferencedFile.filename + "."); + assert.equal(resultReferencedFile.fileName, expectedReferencedFile.fileName, "Referenced file path does not match expected. Expected: " + expectedReferencedFile.fileName + ". Actual: " + resultReferencedFile.fileName + "."); assert.equal(resultReferencedFile.pos, expectedReferencedFile.pos, "Referenced file position does not match expected. Expected: " + expectedReferencedFile.pos + ". Actual: " + resultReferencedFile.pos + "."); @@ -47,8 +47,8 @@ describe('PreProcessFile:', function () { it("Correctly return referenced files from triple slash", function () { test("///" + "\n" + "///" + "\n" + "///" + "\n" + "///", true, { - referencedFiles: [{ filename: "refFile1.ts", pos: 0, end: 37 }, { filename: "refFile2.ts", pos: 38, end: 73 }, - { filename: "refFile3.ts", pos: 74, end: 109 }, { filename: "..\\refFile4d.ts", pos: 110, end: 150 }], + referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 37 }, { fileName: "refFile2.ts", pos: 38, end: 73 }, + { fileName: "refFile3.ts", pos: 74, end: 109 }, { fileName: "..\\refFile4d.ts", pos: 110, end: 150 }], importedFiles: [], isLibFile: false }); @@ -67,8 +67,8 @@ describe('PreProcessFile:', function () { test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require (\"r5.ts\");", true, { referencedFiles: [], - importedFiles: [{ filename: "r1.ts", pos: 20, end: 25 }, { filename: "r2.ts", pos: 49, end: 54 }, { filename: "r3.ts", pos: 78, end: 83 }, - { filename: "r4.ts", pos: 106, end: 111 }, { filename: "r5.ts", pos: 138, end: 143 }], + importedFiles: [{ fileName: "r1.ts", pos: 20, end: 25 }, { fileName: "r2.ts", pos: 49, end: 54 }, { fileName: "r3.ts", pos: 78, end: 83 }, + { fileName: "r4.ts", pos: 106, end: 111 }, { fileName: "r5.ts", pos: 138, end: 143 }], isLibFile: false }); }), @@ -86,7 +86,7 @@ describe('PreProcessFile:', function () { test("import i1 require(\"r1.ts\"); import = require(\"r2.ts\") import i3= require(\"r3.ts\"); import i5", true, { referencedFiles: [], - importedFiles: [{ filename: "r3.ts", pos: 73, end: 78 }], + importedFiles: [{ fileName: "r3.ts", pos: 73, end: 78 }], isLibFile: false }); }), @@ -94,8 +94,8 @@ describe('PreProcessFile:', function () { it("Correctly return referenced files and import files", function () { test("///" + "\n" + "///" + "\n" + "import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\");", true, { - referencedFiles: [{ filename: "refFile1.ts", pos: 0, end: 35 }, { filename: "refFile2.ts", pos: 36, end: 71 }], - importedFiles: [{ filename: "r1.ts", pos: 92, end: 97 }, { filename: "r2.ts", pos: 121, end: 126 }], + referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }, { fileName: "refFile2.ts", pos: 36, end: 71 }], + importedFiles: [{ fileName: "r1.ts", pos: 92, end: 97 }, { fileName: "r2.ts", pos: 121, end: 126 }], isLibFile: false }); }), @@ -103,8 +103,8 @@ describe('PreProcessFile:', function () { it("Correctly return referenced files and import files even with some invalid syntax", function () { test("///" + "\n" + "///" + "\n" + "import i1 = require(\"r1.ts\"); import = require(\"r2.ts\"); import i2 = require(\"r3.ts\");", true, { - referencedFiles: [{ filename: "refFile1.ts", pos: 0, end: 35 }], - importedFiles: [{ filename: "r1.ts", pos: 91, end: 96 }, { filename: "r3.ts", pos: 148, end: 153 }], + referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }], + importedFiles: [{ fileName: "r1.ts", pos: 91, end: 96 }, { fileName: "r3.ts", pos: 148, end: 153 }], isLibFile: false }) });