From b399ce8c8dd267e454563cdb599cd6068c58bffc Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 6 Jan 2015 15:55:02 +0100 Subject: [PATCH] extract no extension but non ts extensions allowed into its own clause. make boolean expression more natural to read --- src/compiler/parser.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 543c036d5cb..e4e9d12ead3 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -5231,7 +5231,10 @@ module ts { } } else { - if (!((options.allowNonTsExtensions && findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) || findSourceFile(filename + ".ts", isDefaultLib, refFile, refPos, refEnd) || findSourceFile(filename + ".d.ts", isDefaultLib, refFile, refPos, refEnd))) { + if(options.allowNonTsExtensions && !findSourceFile(filename, isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = Diagnostics.File_0_not_found; + } + else if (!findSourceFile(filename + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(filename + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { diagnostic = Diagnostics.File_0_not_found; filename += ".ts"; }