From 507d6429c4c836a950e4dbafdbf48e807bf334cd Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 22 Jul 2020 17:14:05 -0400 Subject: [PATCH] simplify decodeLocalsAt --- libs/remix-debug/src/Ethdebugger.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libs/remix-debug/src/Ethdebugger.js b/libs/remix-debug/src/Ethdebugger.js index a559ef5ccc..612e6ffabf 100644 --- a/libs/remix-debug/src/Ethdebugger.js +++ b/libs/remix-debug/src/Ethdebugger.js @@ -75,20 +75,18 @@ Ethdebugger.prototype.extractLocalsAt = function (step) { return this.callTree.findScope(step) } -Ethdebugger.prototype.decodeLocalsAt = function (step, sourceLocation, callback) { +Ethdebugger.prototype.decodeLocalsAt = async function (step, sourceLocation, callback) { try { const stack = this.traceManager.getStackAt(step) const memory = this.traceManager.getMemoryAt(step) const address = this.traceManager.getCurrentCalledAddressAt(step) try { const storageViewer = new StorageViewer({ stepIndex: step, tx: this.tx, address: address }, this.storageResolver, this.traceManager) - localDecoder.solidityLocals(step, this.callTree, stack, memory, storageViewer, sourceLocation).then((locals) => { - if (!locals.error) { - callback(null, locals) - } else { - callback(locals.error) - } - }) + const locals = await localDecoder.solidityLocals(step, this.callTree, stack, memory, storageViewer, sourceLocation) + if (locals.error) { + return callback(locals.error) + } + return callback(null, locals) } catch (e) { callback(e.message) }