aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov/src/source_maps.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-22 02:06:53 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-22 02:06:53 +0800
commit8e2c0bb97758a978f704ad8aea916cbfe43abc16 (patch)
treed0a49d1e2daf720deea5bbb749a4184518038ee3 /packages/sol-cov/src/source_maps.ts
parentc34897036e8cf896e6d0b3c7733ed9c739921f74 (diff)
parent88500e37146dc9152050fdd810f9f3c3cc5faf9f (diff)
downloaddexon-sol-tools-8e2c0bb97758a978f704ad8aea916cbfe43abc16.tar
dexon-sol-tools-8e2c0bb97758a978f704ad8aea916cbfe43abc16.tar.gz
dexon-sol-tools-8e2c0bb97758a978f704ad8aea916cbfe43abc16.tar.bz2
dexon-sol-tools-8e2c0bb97758a978f704ad8aea916cbfe43abc16.tar.lz
dexon-sol-tools-8e2c0bb97758a978f704ad8aea916cbfe43abc16.tar.xz
dexon-sol-tools-8e2c0bb97758a978f704ad8aea916cbfe43abc16.tar.zst
dexon-sol-tools-8e2c0bb97758a978f704ad8aea916cbfe43abc16.zip
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/mobile-friendly-onboarding
Diffstat (limited to 'packages/sol-cov/src/source_maps.ts')
-rw-r--r--packages/sol-cov/src/source_maps.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/sol-cov/src/source_maps.ts b/packages/sol-cov/src/source_maps.ts
index f9503e16c..90b21dda1 100644
--- a/packages/sol-cov/src/source_maps.ts
+++ b/packages/sol-cov/src/source_maps.ts
@@ -36,7 +36,7 @@ export function parseSourceMap(
): { [programCounter: number]: SourceRange } {
const bytecode = Uint8Array.from(Buffer.from(bytecodeHex, 'hex'));
const pcToInstructionIndex: { [programCounter: number]: number } = getPcToInstructionIndexMapping(bytecode);
- const locationByOffsetByFileIndex = _.map(sourceCodes, getLocationByOffset);
+ const locationByOffsetByFileIndex = _.map(sourceCodes, s => (_.isUndefined(s) ? {} : getLocationByOffset(s)));
const entries = srcMap.split(';');
let lastParsedEntry: SourceLocation = {} as any;
const instructionIndexToSourceRange: { [instructionIndex: number]: SourceRange } = {};
@@ -56,7 +56,7 @@ export function parseSourceMap(
length,
fileIndex,
};
- if (parsedEntry.fileIndex !== -1) {
+ if (parsedEntry.fileIndex !== -1 && !_.isUndefined(locationByOffsetByFileIndex[parsedEntry.fileIndex])) {
const sourceRange = {
location: {
start: locationByOffsetByFileIndex[parsedEntry.fileIndex][parsedEntry.offset],