[gjs] coverage: Use a closure instead of this
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] coverage: Use a closure instead of this
- Date: Mon, 3 Feb 2014 21:45:07 +0000 (UTC)
commit 927025163bb3c46fd8cfaf26745bb5adad84825f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Feb 3 14:40:53 2014 -0500
coverage: Use a closure instead of this
modules/coverage.js | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/modules/coverage.js b/modules/coverage.js
index 3525bee..8ec96a2 100644
--- a/modules/coverage.js
+++ b/modules/coverage.js
@@ -648,26 +648,25 @@ function _convertFunctionCountersToArray(functionCounters) {
}
function CoverageStatisticsContainer(files) {
+ let pendingFiles = [];
+ let coveredFiles = {};
- this._pendingFiles = [];
- this._coveredFiles = {};
-
- this._ensureStatisticsFor = function(filename) {
- let statistics = _createStatisticsForFoundFilename(filename, this._pendingFiles);
+ function ensureStatisticsFor(filename) {
+ let statistics = _createStatisticsForFoundFilename(filename, pendingFiles);
if (statistics)
- this._coveredFiles[filename] = statistics;
- };
+ coveredFiles[filename] = statistics;
+ }
this.fetchStatistics = function(filename) {
- this._ensureStatisticsFor(filename);
- let statistics = this._coveredFiles[filename];
+ ensureStatisticsFor(filename);
+ let statistics = coveredFiles[filename];
if (statistics === undefined)
throw new Error('Not tracking statistics for ' + filename);
return statistics;
};
for (let file of files)
- this._pendingFiles.push(file);
+ pendingFiles.push(file);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]