aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-trace
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2019-01-15 21:45:02 +0800
committerGitHub <noreply@github.com>2019-01-15 21:45:02 +0800
commit18084588ea9fa724d6e32c9a49c79d49f189ba7c (patch)
tree7944152430a9687e7e63db4011bacaf2fa3aebe3 /packages/sol-trace
parent16a2cf7be68605def2824de4f5c22f0154c2e6ad (diff)
parent64d99dc07cc82c7cc2917871596b46985f1d709f (diff)
downloaddexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar
dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.gz
dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.bz2
dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.lz
dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.xz
dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.zst
dexon-sol-tools-18084588ea9fa724d6e32c9a49c79d49f189ba7c.zip
Merge pull request #1498 from 0xProject/fix/sol-cov
Sol tracing fixes
Diffstat (limited to 'packages/sol-trace')
-rw-r--r--packages/sol-trace/src/index.ts2
-rw-r--r--packages/sol-trace/src/revert_trace_subprovider.ts3
2 files changed, 4 insertions, 1 deletions
diff --git a/packages/sol-trace/src/index.ts b/packages/sol-trace/src/index.ts
index 120c0d0a9..61b5d8cb7 100644
--- a/packages/sol-trace/src/index.ts
+++ b/packages/sol-trace/src/index.ts
@@ -3,6 +3,8 @@ export {
TruffleArtifactAdapter,
SolCompilerArtifactAdapter,
ContractData,
+ SourceCodes,
+ Sources,
} from '@0x/sol-tracing-utils';
export { RevertTraceSubprovider } from './revert_trace_subprovider';
diff --git a/packages/sol-trace/src/revert_trace_subprovider.ts b/packages/sol-trace/src/revert_trace_subprovider.ts
index 31067a402..fa065cfcb 100644
--- a/packages/sol-trace/src/revert_trace_subprovider.ts
+++ b/packages/sol-trace/src/revert_trace_subprovider.ts
@@ -106,7 +106,8 @@ export class RevertTraceSubprovider extends TraceCollectionSubprovider {
continue;
}
- const fileIndex = contractData.sources.indexOf(sourceRange.fileName);
+ const fileNameToFileIndex = _.invert(contractData.sources);
+ const fileIndex = _.parseInt(fileNameToFileIndex[sourceRange.fileName]);
const sourceSnippet = getSourceRangeSnippet(sourceRange, contractData.sourceCodes[fileIndex]);
if (sourceSnippet !== null) {
sourceSnippets.push(sourceSnippet);