保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 9bdb95c9e34cef640534e5e5a1e2225a80442000
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];
            }
        });
    }