Skip to content

Commit de13648

Browse files
Merge pull request #1918 from Microsoft/filename
Fix spelling of 'Filename' to be 'FileName'.
2 parents b4e5d5b + 4296239 commit de13648

File tree

62 files changed

+1010
-1010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1010
-1010
lines changed

src/compiler/binder.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ module ts {
471471
break;
472472
case SyntaxKind.SourceFile:
473473
if (isExternalModule(<SourceFile>node)) {
474-
bindAnonymousDeclaration(<SourceFile>node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).filename) + '"', /*isBlockScopeContainer*/ true);
474+
bindAnonymousDeclaration(<SourceFile>node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).fileName) + '"', /*isBlockScopeContainer*/ true);
475475
break;
476476
}
477477
case SyntaxKind.Block:

src/compiler/checker.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ module ts {
538538
}
539539

540540
var moduleReferenceLiteral = <LiteralExpression>moduleReferenceExpression;
541-
var searchPath = getDirectoryPath(getSourceFile(location).filename);
541+
var searchPath = getDirectoryPath(getSourceFile(location).fileName);
542542

543543
// Module names are escaped in our symbol table. However, string literal values aren't.
544544
// Escape the name in the "require(...)" clause to ensure we find the right symbol.
@@ -553,8 +553,8 @@ module ts {
553553
}
554554
}
555555
while (true) {
556-
var filename = normalizePath(combinePaths(searchPath, moduleName));
557-
var sourceFile = host.getSourceFile(filename + ".ts") || host.getSourceFile(filename + ".d.ts");
556+
var fileName = normalizePath(combinePaths(searchPath, moduleName));
557+
var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts");
558558
if (sourceFile || isRelative) break;
559559
var parentPath = getDirectoryPath(searchPath);
560560
if (parentPath === searchPath) break;
@@ -564,7 +564,7 @@ module ts {
564564
if (sourceFile.symbol) {
565565
return getResolvedExportSymbol(sourceFile.symbol);
566566
}
567-
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_an_external_module, sourceFile.filename);
567+
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName);
568568
return;
569569
}
570570
error(moduleReferenceLiteral, Diagnostics.Cannot_find_external_module_0, moduleName);

src/compiler/commandLineParser.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ module ts {
164164

165165
export function parseCommandLine(commandLine: string[]): ParsedCommandLine {
166166
var options: CompilerOptions = {};
167-
var filenames: string[] = [];
167+
var fileNames: string[] = [];
168168
var errors: Diagnostic[] = [];
169169
var shortOptionNames: Map<string> = {};
170170
var optionNameMap: Map<CommandLineOption> = {};
@@ -178,7 +178,7 @@ module ts {
178178
parseStrings(commandLine);
179179
return {
180180
options,
181-
filenames,
181+
fileNames,
182182
errors
183183
};
184184

@@ -232,16 +232,16 @@ module ts {
232232
}
233233
}
234234
else {
235-
filenames.push(s);
235+
fileNames.push(s);
236236
}
237237
}
238238
}
239239

240-
function parseResponseFile(filename: string) {
241-
var text = sys.readFile(filename);
240+
function parseResponseFile(fileName: string) {
241+
var text = sys.readFile(fileName);
242242

243243
if (!text) {
244-
errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, filename));
244+
errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, fileName));
245245
return;
246246
}
247247

@@ -259,7 +259,7 @@ module ts {
259259
pos++;
260260
}
261261
else {
262-
errors.push(createCompilerDiagnostic(Diagnostics.Unterminated_quoted_string_in_response_file_0, filename));
262+
errors.push(createCompilerDiagnostic(Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName));
263263
}
264264
}
265265
else {
@@ -271,9 +271,9 @@ module ts {
271271
}
272272
}
273273

274-
export function readConfigFile(filename: string): any {
274+
export function readConfigFile(fileName: string): any {
275275
try {
276-
var text = sys.readFile(filename);
276+
var text = sys.readFile(fileName);
277277
return /\S/.test(text) ? JSON.parse(text) : {};
278278
}
279279
catch (e) {
@@ -285,7 +285,7 @@ module ts {
285285

286286
return {
287287
options: getCompilerOptions(),
288-
filenames: getFiles(),
288+
fileNames: getFiles(),
289289
errors
290290
};
291291

src/compiler/core.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,12 @@ module ts {
364364
return a < b ? Comparison.LessThan : Comparison.GreaterThan;
365365
}
366366

367-
function getDiagnosticFilename(diagnostic: Diagnostic): string {
368-
return diagnostic.file ? diagnostic.file.filename : undefined;
367+
function getDiagnosticFileName(diagnostic: Diagnostic): string {
368+
return diagnostic.file ? diagnostic.file.fileName : undefined;
369369
}
370370

371371
export function compareDiagnostics(d1: Diagnostic, d2: Diagnostic): number {
372-
return compareValues(getDiagnosticFilename(d1), getDiagnosticFilename(d2)) ||
372+
return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) ||
373373
compareValues(d1.start, d2.start) ||
374374
compareValues(d1.length, d2.length) ||
375375
compareValues(d1.code, d2.code) ||
@@ -472,8 +472,8 @@ module ts {
472472
return normalizedPathComponents(path, rootLength);
473473
}
474474

475-
export function getNormalizedAbsolutePath(filename: string, currentDirectory: string) {
476-
return getNormalizedPathFromPathComponents(getNormalizedPathComponents(filename, currentDirectory));
475+
export function getNormalizedAbsolutePath(fileName: string, currentDirectory: string) {
476+
return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory));
477477
}
478478

479479
export function getNormalizedPathFromPathComponents(pathComponents: string[]) {
@@ -571,7 +571,7 @@ module ts {
571571
return absolutePath;
572572
}
573573

574-
export function getBaseFilename(path: string) {
574+
export function getBaseFileName(path: string) {
575575
var i = path.lastIndexOf(directorySeparator);
576576
return i < 0 ? path : path.substring(i + 1);
577577
}
@@ -644,7 +644,7 @@ module ts {
644644
}
645645
}
646646

647-
export function getDefaultLibFilename(options: CompilerOptions): string {
647+
export function getDefaultLibFileName(options: CompilerOptions): string {
648648
return options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts";
649649
}
650650

src/compiler/diagnosticInformationMap.generated.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ module ts {
109109
Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." },
110110
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." },
111111
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." },
112-
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" },
112+
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" },
113113
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<T>()' instead." },
114114
var_let_or_const_expected: { code: 1152, category: DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." },
115115
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." },

src/compiler/diagnosticMessages.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@
427427
"category": "Error",
428428
"code": 1148
429429
},
430-
"Filename '{0}' differs from already included filename '{1}' only in casing": {
430+
"File name '{0}' differs from already included file name '{1}' only in casing": {
431431
"category": "Error",
432432
"code": 1149
433433
},

src/compiler/emitter.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ module ts {
5555

5656
export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean {
5757
if (!isDeclarationFile(sourceFile)) {
58-
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.filename, ".js")) {
58+
if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.fileName, ".js")) {
5959
return true;
6060
}
6161
return false;
@@ -314,7 +314,7 @@ module ts {
314314
}
315315

316316
function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string) {
317-
var sourceFilePath = getNormalizedAbsolutePath(sourceFile.filename, host.getCurrentDirectory());
317+
var sourceFilePath = getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory());
318318
sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), "");
319319
return combinePaths(newDirPath, sourceFilePath);
320320
}
@@ -325,15 +325,15 @@ module ts {
325325
var emitOutputFilePathWithoutExtension = removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir));
326326
}
327327
else {
328-
var emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.filename);
328+
var emitOutputFilePathWithoutExtension = removeFileExtension(sourceFile.fileName);
329329
}
330330

331331
return emitOutputFilePathWithoutExtension + extension;
332332
}
333333

334-
function writeFile(host: EmitHost, diagnostics: Diagnostic[], filename: string, data: string, writeByteOrderMark: boolean) {
335-
host.writeFile(filename, data, writeByteOrderMark, hostErrorMessage => {
336-
diagnostics.push(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, filename, hostErrorMessage));
334+
function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean) {
335+
host.writeFile(fileName, data, writeByteOrderMark, hostErrorMessage => {
336+
diagnostics.push(createCompilerDiagnostic(Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage));
337337
});
338338
}
339339

@@ -1481,7 +1481,7 @@ module ts {
14811481

14821482
function writeReferencePath(referencedFile: SourceFile) {
14831483
var declFileName = referencedFile.flags & NodeFlags.DeclarationFile
1484-
? referencedFile.filename // Declaration file, use declaration file name
1484+
? referencedFile.fileName // Declaration file, use declaration file name
14851485
: shouldEmitToOwnFile(referencedFile, compilerOptions)
14861486
? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file
14871487
: removeFileExtension(compilerOptions.out) + ".d.ts";// Global out file
@@ -1735,14 +1735,14 @@ module ts {
17351735
var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
17361736

17371737
sourceMapData.sourceMapSources.push(getRelativePathToDirectoryOrUrl(sourcesDirectoryPath,
1738-
node.filename,
1738+
node.fileName,
17391739
host.getCurrentDirectory(),
17401740
host.getCanonicalFileName,
17411741
/*isAbsolutePathAnUrl*/ true));
17421742
sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1;
17431743

17441744
// The one that can be used from program to get the actual source file
1745-
sourceMapData.inputSourceFileNames.push(node.filename);
1745+
sourceMapData.inputSourceFileNames.push(node.fileName);
17461746
}
17471747

17481748
function recordScopeNameOfNode(node: Node, scopeName?: string) {
@@ -1857,7 +1857,7 @@ module ts {
18571857
}
18581858

18591859
// Initialize source map data
1860-
var sourceMapJsFile = getBaseFilename(normalizeSlashes(jsFilePath));
1860+
var sourceMapJsFile = getBaseFileName(normalizeSlashes(jsFilePath));
18611861
sourceMapData = {
18621862
sourceMapFilePath: jsFilePath + ".map",
18631863
jsSourceMappingURL: sourceMapJsFile + ".map",

src/compiler/parser.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ module ts {
667667
if (sourceFile.statements.length === 0) {
668668
// If we don't have any statements in the current source file, then there's no real
669669
// way to incrementally parse. So just do a full parse instead.
670-
return parseSourceFile(sourceFile.filename, newText, sourceFile.languageVersion,/*syntaxCursor*/ undefined, /*setNodeParents*/ true)
670+
return parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion,/*syntaxCursor*/ undefined, /*setNodeParents*/ true)
671671
}
672672

673673
var syntaxCursor = createSyntaxCursor(sourceFile);
@@ -713,7 +713,7 @@ module ts {
713713
// inconsistent tree. Setting the parents on the new tree should be very fast. We
714714
// will immediately bail out of walking any subtrees when we can see that their parents
715715
// are already correct.
716-
var result = parseSourceFile(sourceFile.filename, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true)
716+
var result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true)
717717

718718
return result;
719719
}
@@ -857,11 +857,11 @@ module ts {
857857
}
858858
}
859859
}
860-
export function createSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false): SourceFile {
861-
return parseSourceFile(filename, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes);
860+
export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes = false): SourceFile {
861+
return parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes);
862862
}
863863

864-
function parseSourceFile(filename: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: SyntaxCursor, setParentNodes = false): SourceFile {
864+
function parseSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: SyntaxCursor, setParentNodes = false): SourceFile {
865865
var parsingContext: ParsingContext = 0;
866866
var identifiers: Map<string> = {};
867867
var identifierCount = 0;
@@ -876,8 +876,8 @@ module ts {
876876
sourceFile.parseDiagnostics = [];
877877
sourceFile.semanticDiagnostics = [];
878878
sourceFile.languageVersion = languageVersion;
879-
sourceFile.filename = normalizePath(filename);
880-
sourceFile.flags = fileExtensionIs(sourceFile.filename, ".d.ts") ? NodeFlags.DeclarationFile : 0;
879+
sourceFile.fileName = normalizePath(fileName);
880+
sourceFile.flags = fileExtensionIs(sourceFile.fileName, ".d.ts") ? NodeFlags.DeclarationFile : 0;
881881

882882
// Flags that dictate what parsing context we're in. For example:
883883
// Whether or not we are in strict parsing mode. All that changes in strict parsing mode is

0 commit comments

Comments
 (0)