From ee31d5e24d92fc42c003bd49c98e674498a0dfed Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 9 Mar 2018 16:04:37 +0100 Subject: Introduce redundant vars --- packages/sol-cov/src/coverage_manager.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'packages/sol-cov/src') diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index 5d11800f9..c1ca7142e 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -41,7 +41,8 @@ function getSingleFileCoverageForTrace( sourceRanges = _.uniqBy(sourceRanges, s => JSON.stringify(s)); // We don't care if one PC was covered multiple times within a single transaction sourceRanges = _.filter(sourceRanges, sourceRange => sourceRange.fileName === fileName); const branchCoverage: BranchCoverage = {}; - for (const branchId of _.keys(coverageEntriesDescription.branchMap)) { + const branchIds = _.keys(coverageEntriesDescription.branchMap); + for (const branchId of branchIds) { const branchDescription = coverageEntriesDescription.branchMap[branchId]; const isCovered = _.map(branchDescription.locations, location => _.some(sourceRanges, range => utils.isRangeInside(range.location, location)), @@ -49,13 +50,15 @@ function getSingleFileCoverageForTrace( branchCoverage[branchId] = isCovered; } const statementCoverage: StatementCoverage = {}; - for (const statementId of _.keys(coverageEntriesDescription.statementMap)) { + const statementIds = _.keys(coverageEntriesDescription.statementMap); + for (const statementId of statementIds) { const statementDescription = coverageEntriesDescription.statementMap[statementId]; const isCovered = _.some(sourceRanges, range => utils.isRangeInside(range.location, statementDescription)); statementCoverage[statementId] = isCovered; } const functionCoverage: FunctionCoverage = {}; - for (const fnId of _.keys(coverageEntriesDescription.fnMap)) { + const functionIds = _.keys(coverageEntriesDescription.fnMap); + for (const fnId of functionIds) { const functionDescription = coverageEntriesDescription.fnMap[fnId]; const isCovered = _.some(sourceRanges, range => utils.isRangeInside(range.location, functionDescription.loc)); functionCoverage[fnId] = isCovered; -- cgit v1.2.3