CR feedback / Change upper limit / Add disableSizeLimit compiler option

# Conflicts:
#	src/compiler/commandLineParser.ts
#	src/compiler/diagnosticMessages.json
This commit is contained in:
zhengbli
2016-03-14 14:51:24 -07:00
parent 708fb972f2
commit 35b972e1d8
7 changed files with 65 additions and 30 deletions

View File

@@ -394,24 +394,38 @@ namespace ts {
(oldOptions.target !== options.target) ||
(oldOptions.noLib !== options.noLib) ||
(oldOptions.jsx !== options.jsx) ||
(oldOptions.allowJs !== options.allowJs)) {
(oldOptions.allowJs !== options.allowJs) ||
(oldOptions.disableSizeLimit !== options.disableSizeLimit)) {
oldProgram = undefined;
}
}
if (!tryReuseStructureFromOldProgram()) {
let programSize = 0;
for (const name of rootNames) {
const path = toPath(name, currentDirectory, getCanonicalFileName);
if (programSize <= maxProgramSize) {
processRootFile(name, /*isDefaultLib*/ false);
if (!hasTypeScriptFileExtension(name) && filesByName.get(path)) {
programSize += filesByName.get(path).text.length;
if (options.disableSizeLimit === true) {
forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false));
}
else {
let programSize = 0;
for (const name of rootNames) {
const path = toPath(name, currentDirectory, getCanonicalFileName);
if (programSize <= maxProgramSize) {
processRootFile(name, /*isDefaultLib*/ false);
const file = filesByName.get(path);
if (!hasTypeScriptFileExtension(name) && file && file.text) {
programSize += file.text.length;
}
}
else {
// If the program size limit was reached when processing a file, this file is
// likely in the problematic folder than contains too many files
const commonSourceDirectory = getCommonSourceDirectory();
let rootLevelDirectory = path.substring(0, Math.max(commonSourceDirectory.length, path.indexOf(directorySeparator, commonSourceDirectory.length)));
if (rootLevelDirectory[rootLevelDirectory.length - 1] !== directorySeparator) {
rootLevelDirectory += directorySeparator;
}
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Too_many_JavaScript_files_in_the_project_Use_an_exact_files_list_or_use_the_exclude_setting_in_project_configuration_to_limit_included_source_folders_The_likely_folder_to_exclude_is_0_To_disable_the_project_size_limit_set_the_disableSizeLimit_compiler_option_to_true, rootLevelDirectory));
break;
}
}
else {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Too_many_javascript_files_in_the_project_Consider_add_to_the_exclude_list_in_the_config_file));
break;
}
}