diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-17 21:37:15 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-17 21:37:15 +0800 |
commit | fcdd0de9eea6b06449aaa9ac71dadfcd4faf4968 (patch) | |
tree | e175bfac31bea9fd3dee51aa69cbcc84291df9ea /packages/sol-trace/src | |
parent | 4c5bde1b544f66d70957824658ad37230735d527 (diff) | |
download | dexon-sol-tools-fcdd0de9eea6b06449aaa9ac71dadfcd4faf4968.tar dexon-sol-tools-fcdd0de9eea6b06449aaa9ac71dadfcd4faf4968.tar.gz dexon-sol-tools-fcdd0de9eea6b06449aaa9ac71dadfcd4faf4968.tar.bz2 dexon-sol-tools-fcdd0de9eea6b06449aaa9ac71dadfcd4faf4968.tar.lz dexon-sol-tools-fcdd0de9eea6b06449aaa9ac71dadfcd4faf4968.tar.xz dexon-sol-tools-fcdd0de9eea6b06449aaa9ac71dadfcd4faf4968.tar.zst dexon-sol-tools-fcdd0de9eea6b06449aaa9ac71dadfcd4faf4968.zip |
Fix/simplify handling of revert trace snippets
Diffstat (limited to 'packages/sol-trace/src')
-rw-r--r-- | packages/sol-trace/src/revert_trace_subprovider.ts | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/packages/sol-trace/src/revert_trace_subprovider.ts b/packages/sol-trace/src/revert_trace_subprovider.ts index fa065cfcb..046dad812 100644 --- a/packages/sol-trace/src/revert_trace_subprovider.ts +++ b/packages/sol-trace/src/revert_trace_subprovider.ts @@ -109,9 +109,7 @@ export class RevertTraceSubprovider extends TraceCollectionSubprovider { const fileNameToFileIndex = _.invert(contractData.sources); const fileIndex = _.parseInt(fileNameToFileIndex[sourceRange.fileName]); const sourceSnippet = getSourceRangeSnippet(sourceRange, contractData.sourceCodes[fileIndex]); - if (sourceSnippet !== null) { - sourceSnippets.push(sourceSnippet); - } + sourceSnippets.push(sourceSnippet); } const filteredSnippets = filterSnippets(sourceSnippets); if (filteredSnippets.length > 0) { @@ -135,9 +133,7 @@ function filterSnippets(sourceSnippets: SourceSnippet[]): SourceSnippet[] { const results: SourceSnippet[] = [sourceSnippets[0]]; let prev = sourceSnippets[0]; for (const sourceSnippet of sourceSnippets) { - if (sourceSnippet.type === 'IfStatement') { - continue; - } else if (sourceSnippet.source === prev.source) { + if (sourceSnippet.source === prev.source) { prev = sourceSnippet; continue; } @@ -157,12 +153,5 @@ function getStackTraceString(sourceSnippet: SourceSnippet): string { } function getSourceSnippetString(sourceSnippet: SourceSnippet): string { - switch (sourceSnippet.type) { - case 'ContractDefinition': - return `contract ${sourceSnippet.name}`; - case 'FunctionDefinition': - return `function ${sourceSnippet.name}`; - default: - return `${sourceSnippet.source}`; - } + return `${sourceSnippet.source}`; } |