Add upper limit for the program size, fix readDirectory for the symlink files

This commit is contained in:
zhengbli
2016-03-11 15:56:36 -08:00
parent 4927091060
commit 3b5555862c
6 changed files with 63 additions and 13 deletions

View File

@@ -400,7 +400,21 @@ namespace ts {
}
if (!tryReuseStructureFromOldProgram()) {
forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false));
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;
}
}
else {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Too_many_javascript_files_in_the_project_Consider_add_to_the_exclude_list_in_the_config_file));
break;
}
}
// Do not process the default library if:
// - The '--noLib' flag is used.
// - A 'no-default-lib' reference comment is encountered in