From ab4e8129d5c94ff96e6c85d0d2b66a04a052b4e5 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:26:15 +0800 Subject: [PATCH] TODO#139888 嚴選配對 - 文案修改 --- PAMapp/node_modules/istanbul-lib-instrument/src/source-coverage.js | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/PAMapp/node_modules/istanbul-lib-instrument/src/source-coverage.js b/PAMapp/node_modules/istanbul-lib-instrument/src/source-coverage.js index 1f4fe87..ec3f234 100644 --- a/PAMapp/node_modules/istanbul-lib-instrument/src/source-coverage.js +++ b/PAMapp/node_modules/istanbul-lib-instrument/src/source-coverage.js @@ -57,7 +57,7 @@ return f; } - newBranch(type, loc) { + newBranch(type, loc, isReportLogic = false) { const b = this.meta.last.b; this.data.b[b] = []; this.data.branchMap[b] = { @@ -68,7 +68,19 @@ line: loc && loc.start.line }; this.meta.last.b += 1; + this.maybeNewBranchTrue(type, b, isReportLogic); return b; + } + + maybeNewBranchTrue(type, name, isReportLogic) { + if (!isReportLogic) { + return; + } + if (type !== 'binary-expr') { + return; + } + this.data.bT = this.data.bT || {}; + this.data.bT[name] = []; } addBranchPath(name, location) { @@ -81,7 +93,19 @@ } bMeta.locations.push(cloneLocation(location)); counts.push(0); + this.maybeAddBranchTrue(name); return counts.length - 1; + } + + maybeAddBranchTrue(name) { + if (!this.data.bT) { + return; + } + const countsTrue = this.data.bT[name]; + if (!countsTrue) { + return; + } + countsTrue.push(0); } /** @@ -97,10 +121,12 @@ // prune empty branches const map = this.data.branchMap; const branches = this.data.b; + const branchesT = this.data.bT || {}; Object.keys(map).forEach(b => { if (map[b].locations.length === 0) { delete map[b]; delete branches[b]; + delete branchesT[b]; } }); } -- Gitblit v1.8.0