diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-16 02:38:23 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-16 02:38:23 +0800 |
commit | 7a2b312d64994f96db75864e9a61bb319efdda3a (patch) | |
tree | 6d7b030abe774c619067ae52e0ef1cf7ebdd0963 /packages/sol-tracing-utils/src/collect_coverage_entries.ts | |
parent | 64a78149aa4a35aa339fb9ef80faea613ebaeffd (diff) | |
parent | f570f80674c22f69712c45e8e3c48e948b51f357 (diff) | |
download | dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.gz dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.bz2 dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.lz dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.xz dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.zst dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.zip |
Merge branch 'development' into fix/asset-buyer/zero-amount-available-test
Diffstat (limited to 'packages/sol-tracing-utils/src/collect_coverage_entries.ts')
-rw-r--r-- | packages/sol-tracing-utils/src/collect_coverage_entries.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/sol-tracing-utils/src/collect_coverage_entries.ts b/packages/sol-tracing-utils/src/collect_coverage_entries.ts index bdbcd613e..9e3591d74 100644 --- a/packages/sol-tracing-utils/src/collect_coverage_entries.ts +++ b/packages/sol-tracing-utils/src/collect_coverage_entries.ts @@ -3,24 +3,24 @@ import * as _ from 'lodash'; import * as parser from 'solidity-parser-antlr'; import { ASTVisitor, CoverageEntriesDescription } from './ast_visitor'; -import { getLocationByOffset } from './source_maps'; +import { getOffsetToLocation } from './source_maps'; const IGNORE_RE = /\/\*\s*solcov\s+ignore\s+next\s*\*\/\s*/gm; // Parsing source code for each transaction/code is slow and therefore we cache it -const coverageEntriesBySourceHash: { [sourceHash: string]: CoverageEntriesDescription } = {}; +const sourceHashToCoverageEntries: { [sourceHash: string]: CoverageEntriesDescription } = {}; export const collectCoverageEntries = (contractSource: string) => { const sourceHash = ethUtil.sha3(contractSource).toString('hex'); - if (_.isUndefined(coverageEntriesBySourceHash[sourceHash]) && !_.isUndefined(contractSource)) { + if (_.isUndefined(sourceHashToCoverageEntries[sourceHash]) && !_.isUndefined(contractSource)) { const ast = parser.parse(contractSource, { range: true }); - const locationByOffset = getLocationByOffset(contractSource); + const offsetToLocation = getOffsetToLocation(contractSource); const ignoreRangesBegingingAt = gatherRangesToIgnore(contractSource); - const visitor = new ASTVisitor(locationByOffset, ignoreRangesBegingingAt); + const visitor = new ASTVisitor(offsetToLocation, ignoreRangesBegingingAt); parser.visit(ast, visitor); - coverageEntriesBySourceHash[sourceHash] = visitor.getCollectedCoverageEntries(); + sourceHashToCoverageEntries[sourceHash] = visitor.getCollectedCoverageEntries(); } - const coverageEntriesDescription = coverageEntriesBySourceHash[sourceHash]; + const coverageEntriesDescription = sourceHashToCoverageEntries[sourceHash]; return coverageEntriesDescription; }; |