Skip to content

Commit 7d3c006

Browse files
committed
Making sys.getMemoryUsage optional.
1 parent 4d62b48 commit 7d3c006

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/compiler/sys.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface System {
1414
createDirectory(directoryName: string): void;
1515
getExecutingFilePath(): string;
1616
getCurrentDirectory(): string;
17-
getMemoryUsage(): number;
17+
getMemoryUsage?(): number;
1818
exit(exitCode?: number): void;
1919
}
2020

@@ -128,9 +128,6 @@ var sys: System = (function () {
128128
getCurrentDirectory() {
129129
return new ActiveXObject("WScript.Shell").CurrentDirectory;
130130
},
131-
getMemoryUsage() {
132-
return 0;
133-
},
134131
exit(exitCode?: number): void {
135132
try {
136133
WScript.Quit(exitCode);

src/compiler/tsc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,14 @@ module ts {
337337

338338
reportDiagnostics(errors);
339339
if (commandLine.options.diagnostics) {
340-
var memoryUsed = sys.getMemoryUsage();
340+
var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
341341
reportCountStatistic("Files", program.getSourceFiles().length);
342342
reportCountStatistic("Lines", countLines(program));
343343
reportCountStatistic("Nodes", checker ? checker.getNodeCount() : 0);
344344
reportCountStatistic("Identifiers", checker ? checker.getIdentifierCount() : 0);
345345
reportCountStatistic("Symbols", checker ? checker.getSymbolCount() : 0);
346346
reportCountStatistic("Types", checker ? checker.getTypeCount() : 0);
347-
if (memoryUsed) {
347+
if (memoryUsed >= 0) {
348348
reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
349349
}
350350
reportTimeStatistic("Parse time", bindStart - parseStart);

0 commit comments

Comments
 (0)