From 523529cc555134ab8bc5a132ac3ed4ace3ba40de Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 4 Apr 2016 14:51:16 -0700 Subject: [PATCH] Use isWatchSet to test for options.watch --- src/compiler/program.ts | 2 +- src/compiler/tsc.ts | 5 ----- src/compiler/utilities.ts | 5 +++++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index ff2efa4a2cb..70c421f9d2b 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -658,7 +658,7 @@ namespace ts { const start = new Date().getTime(); ensureDirectoriesExist(getDirectoryPath(normalizePath(fileName))); - if (options.watch && sys.createHash && sys.getModifiedTime) { + if (isWatchSet(options) && sys.createHash && sys.getModifiedTime) { writeFileIfUpdated(fileName, data, writeByteOrderMark); } else { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index b88dea9d96b..377aca78901 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -240,11 +240,6 @@ namespace ts { return typeof JSON === "object" && typeof JSON.parse === "function"; } - function isWatchSet(options: CompilerOptions) { - // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); - } - export function executeCommandLine(args: string[]): void { const commandLine = parseCommandLine(args); let configFileName: string; // Configuration file name (if any) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ee029b7249f..9d92fb064e4 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2642,6 +2642,11 @@ namespace ts { } return carriageReturnLineFeed; } + + export function isWatchSet(options: CompilerOptions) { + // Firefox has Object.prototype.watch + return options.watch && options.hasOwnProperty("watch"); + } } namespace ts {