From 22ae8121cb5963f4340d0d9f5c97aaad0ff93316 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Fri, 24 Jul 2020 15:46:55 -0400 Subject: [PATCH] refactor extractMappingsLocationChanges --- libs/remix-debug/src/storage/storageViewer.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/libs/remix-debug/src/storage/storageViewer.js b/libs/remix-debug/src/storage/storageViewer.js index 206701a637..0661dd3f9c 100644 --- a/libs/remix-debug/src/storage/storageViewer.js +++ b/libs/remix-debug/src/storage/storageViewer.js @@ -77,13 +77,8 @@ class StorageViewer { async mappingsLocation (corrections) { if (!this.currentMappingsLocationPromise) { this.currentMappingsLocationPromise = new Promise((resolve, reject) => { - this.extractMappingsLocationChanges(this.storageChanges, corrections, (error, mappingsLocationChanges) => { - if (error) { - reject(error) - } else { - resolve(mappingsLocationChanges) - } - }) + const mappingsLocationChanges = this.extractMappingsLocationChanges(this.storageChanges, corrections) + return resolve(mappingsLocationChanges) }) } return this.currentMappingsLocationPromise @@ -94,13 +89,13 @@ class StorageViewer { * @param {Map} storageChanges * @param {Array} corrections - used in case the calculated sha3 has been modifyed before SSTORE (notably used for struct in mapping). */ - extractMappingsLocationChanges (storageChanges, corrections, callback) { + extractMappingsLocationChanges (storageChanges, corrections) { if (this.mappingsLocationChanges) { - return callback(null, this.mappingsLocationChanges) + return this.mappingsLocationChanges } const mappings = mappingPreimages.decodeMappingsKeys(this.web3, storageChanges, corrections) this.mappingsLocationChanges = mappings - return callback(null, this.mappingsLocationChanges) + return this.mappingsLocationChanges } }