From 0d254d6dc5202e86e99c673d8a61cee83611db27 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 24 Jul 2020 15:52:42 -0400 Subject: [PATCH] refactor getSourceLocationFromInstructionIndex --- libs/remix-lib/src/sourceLocationTracker.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libs/remix-lib/src/sourceLocationTracker.js b/libs/remix-lib/src/sourceLocationTracker.js index 7755e1dd8d..f4b27b269e 100644 --- a/libs/remix-lib/src/sourceLocationTracker.js +++ b/libs/remix-lib/src/sourceLocationTracker.js @@ -22,12 +22,9 @@ function SourceLocationTracker (_codeManager) { * @param {Object} contractDetails - AST of compiled contracts * @param {Function} cb - callback function */ -SourceLocationTracker.prototype.getSourceLocationFromInstructionIndex = function (address, index, contracts) { - return new Promise((resolve, reject) => { - extractSourceMap(this, this.codeManager, address, contracts).then((sourceMap) => { - resolve(this.sourceMappingDecoder.atIndex(index, sourceMap)) - }).catch(reject) - }) +SourceLocationTracker.prototype.getSourceLocationFromInstructionIndex = async function (address, index, contracts) { + const sourceMap = await extractSourceMap(this, this.codeManager, address, contracts) + return this.sourceMappingDecoder.atIndex(index, sourceMap) } /**