Skip to content

Commit

Permalink
Merge pull request #1918 from Microsoft/filename
Browse files Browse the repository at this point in the history
Fix spelling of 'Filename' to be 'FileName'.
  • Loading branch information
CyrusNajmabadi committed Feb 4, 2015
2 parents b4e5d5b + 4296239 commit de13648
Show file tree
Hide file tree
Showing 62 changed files with 1,010 additions and 1,010 deletions.
2 changes: 1 addition & 1 deletion src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ module ts {
break;
case SyntaxKind.SourceFile:
if (isExternalModule(<SourceFile>node)) {
bindAnonymousDeclaration(<SourceFile>node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).filename) + '"', /*isBlockScopeContainer*/ true);
bindAnonymousDeclaration(<SourceFile>node, SymbolFlags.ValueModule, '"' + removeFileExtension((<SourceFile>node).fileName) + '"', /*isBlockScopeContainer*/ true);
break;
}
case SyntaxKind.Block:
Expand Down
8 changes: 4 additions & 4 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ module ts {
}

var moduleReferenceLiteral = <LiteralExpression>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.
Expand All @@ -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;
Expand All @@ -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);
Expand Down
20 changes: 10 additions & 10 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> = {};
var optionNameMap: Map<CommandLineOption> = {};
Expand All @@ -178,7 +178,7 @@ module ts {
parseStrings(commandLine);
return {
options,
filenames,
fileNames,
errors
};

Expand Down Expand Up @@ -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;
}

Expand All @@ -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 {
Expand All @@ -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) {
Expand All @@ -285,7 +285,7 @@ module ts {

return {
options: getCompilerOptions(),
filenames: getFiles(),
fileNames: getFiles(),
errors
};

Expand Down
14 changes: 7 additions & 7 deletions src/compiler/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand Down Expand Up @@ -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[]) {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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";
}

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/diagnosticInformationMap.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>()' 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." },
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
20 changes: 10 additions & 10 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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));
});
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<string> = {};
var identifierCount = 0;
Expand All @@ -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
Expand Down
Loading

0 comments on commit de13648

Please sign in to comment.