From 68aca7ee30808cfe1f355aca9d0fd120a7f2b3e8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Jun 2015 17:39:52 -0700 Subject: [PATCH] Use a separate variable to track for if no-default-lib tag was encountered. --- src/compiler/program.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index b3cf7fd3312..9e72ec50951 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -155,18 +155,19 @@ module ts { let diagnosticsProducingTypeChecker: TypeChecker; let noDiagnosticsTypeChecker: TypeChecker; - // shouldExcludeDefaultLib is true if: - // - The '--noLib' flag is used. - // - A 'no-default-lib' reference comment is encountered in - // processing the root files. - let shouldExcludeDefaultLib = options.noLib; + let encounteredTheNoDefaultLibTag = false; let start = new Date().getTime(); host = host || createCompilerHost(options); forEach(rootNames, name => processRootFile(name, /*isDefaultLib */ false)); - if (!shouldExcludeDefaultLib) { + + // Do not process the default library if: + // - The '--noLib' flag is used. + // - A 'no-default-lib' reference comment is encountered in + // processing the root files. + if (!(options.noLib || encounteredTheNoDefaultLibTag)) { processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true); } @@ -387,7 +388,7 @@ module ts { } }); if (file) { - shouldExcludeDefaultLib = shouldExcludeDefaultLib || file.hasNoDefaultLib; + encounteredTheNoDefaultLibTag = encounteredTheNoDefaultLibTag || file.hasNoDefaultLib; // Set the source file for normalized absolute path filesByName[canonicalAbsolutePath] = file;