diff options
author | Remco Bloemen <remco@wicked.ventures> | 2018-12-21 07:27:12 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-11 18:26:38 +0800 |
commit | 296b3d6311186c7444d9d6763f8ee2d3c373dc14 (patch) | |
tree | d0169dc1f4637082be01bd3a3cad4d07796b32bc | |
parent | 4d03c3035c9186d4a05b159f8209cda046b397a3 (diff) | |
download | dexon-sol-tools-296b3d6311186c7444d9d6763f8ee2d3c373dc14.tar dexon-sol-tools-296b3d6311186c7444d9d6763f8ee2d3c373dc14.tar.gz dexon-sol-tools-296b3d6311186c7444d9d6763f8ee2d3c373dc14.tar.bz2 dexon-sol-tools-296b3d6311186c7444d9d6763f8ee2d3c373dc14.tar.lz dexon-sol-tools-296b3d6311186c7444d9d6763f8ee2d3c373dc14.tar.xz dexon-sol-tools-296b3d6311186c7444d9d6763f8ee2d3c373dc14.tar.zst dexon-sol-tools-296b3d6311186c7444d9d6763f8ee2d3c373dc14.zip |
Throw error when source location is missing
-rw-r--r-- | packages/sol-tracing-utils/src/source_maps.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/sol-tracing-utils/src/source_maps.ts b/packages/sol-tracing-utils/src/source_maps.ts index af0fb4035..ceb20d843 100644 --- a/packages/sol-tracing-utils/src/source_maps.ts +++ b/packages/sol-tracing-utils/src/source_maps.ts @@ -67,13 +67,17 @@ export function parseSourceMap( fileIndex, }; if (parsedEntry.fileIndex !== -1 && !_.isUndefined(locationByOffsetByFileIndex[parsedEntry.fileIndex])) { + const locationByOffset = locationByOffsetByFileIndex[parsedEntry.fileIndex]; const sourceRange = { location: { - start: locationByOffsetByFileIndex[parsedEntry.fileIndex][parsedEntry.offset], - end: locationByOffsetByFileIndex[parsedEntry.fileIndex][parsedEntry.offset + parsedEntry.length], + start: locationByOffset[parsedEntry.offset], + end: locationByOffset[parsedEntry.offset + parsedEntry.length], }, fileName: sources[parsedEntry.fileIndex], }; + if (sourceRange.location.start === undefined || sourceRange.location.end === undefined) { + throw new Error(`Error while processing sourcemap: location out of range in ${sourceRange.fileName}`); + } instructionIndexToSourceRange[i] = sourceRange; } else { // Some assembly code generated by Solidity can't be mapped back to a line of source code. |