Skip to content

Commit b6ef323

Browse files
committed
Respond to code review comments
1 parent af661ae commit b6ef323

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/compiler/diagnosticInformationMap.generated.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ module ts {
496496
Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: DiagnosticCategory.Message, key: "Do not emit declarations for code that has an '@internal' annotation." },
497497
Preserve_new_lines_when_emitting_code: { code: 6057, category: DiagnosticCategory.Message, key: "Preserve new-lines when emitting code." },
498498
Specifies_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: DiagnosticCategory.Message, key: "Specifies the root directory of input files. Use to control the output directory structure with --outDir." },
499-
File_0_is_not_under_rootDir_1_RootDir_is_expected_to_contain_all_source_files: { code: 6059, category: DiagnosticCategory.Error, key: "File '{0}' is not under rootDir '{1}'. RootDir is expected to contain all source files." },
499+
File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: DiagnosticCategory.Error, key: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." },
500500
Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." },
501501
Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." },
502502
Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." },

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@
19721972
"category": "Message",
19731973
"code": 6058
19741974
},
1975-
"File '{0}' is not under rootDir '{1}'. RootDir is expected to contain all source files.": {
1975+
"File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files.": {
19761976
"category": "Error",
19771977
"code": 6059
19781978
},

src/compiler/program.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ module ts {
453453
}
454454
}
455455

456-
function computecommonSourceDirectory(sourceFiles: SourceFile[]): string {
456+
function computeCommonSourceDirectory(sourceFiles: SourceFile[]): string {
457457
let commonPathComponents: string[];
458458
let currentDirectory = host.getCurrentDirectory();
459459
forEach(files, sourceFile => {
@@ -465,7 +465,7 @@ module ts {
465465
let sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, currentDirectory);
466466
sourcePathComponents.pop(); // FileName is not part of directory
467467
if (commonPathComponents) {
468-
for (let i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) {
468+
for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) {
469469
if (commonPathComponents[i] !== sourcePathComponents[i]) {
470470
if (i === 0) {
471471
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
@@ -486,24 +486,24 @@ module ts {
486486
else {
487487
// first file
488488
commonPathComponents = sourcePathComponents;
489+
return;
489490
}
490-
491491
});
492492

493493
return getNormalizedPathFromPathComponents(commonPathComponents);
494494
}
495495

496496
function checkSourceFilesBelongToPath(soruceFiles: SourceFile[], rootDirectory: string): boolean {
497497
let allFilesBelongToPath = true;
498-
if (files) {
498+
if (soruceFiles) {
499499
let currentDirectory = host.getCurrentDirectory();
500500
let absoluteRootDirectoryPath = host.getCanonicalFileName(getNormalizedAbsolutePath(rootDirectory, currentDirectory));
501501

502-
for (var sourceFile of files) {
502+
for (var sourceFile of soruceFiles) {
503503
if (!isDeclarationFile(sourceFile)) {
504504
let absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
505505
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
506-
diagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_RootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
506+
diagnostics.add(createCompilerDiagnostic(Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files, sourceFile.fileName, options.rootDir));
507507
allFilesBelongToPath = false;
508508
}
509509
}
@@ -581,7 +581,7 @@ module ts {
581581
}
582582
else {
583583
// Compute the commonSourceDirectory from the input files
584-
commonSourceDirectory = computecommonSourceDirectory(files);
584+
commonSourceDirectory = computeCommonSourceDirectory(files);
585585
}
586586

587587
if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) {

0 commit comments

Comments
 (0)