Commit 05645cb5 authored by yann300's avatar yann300

fix local (add async)

parent 7a3b7d89
'use strict' 'use strict'
function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storageResolver, currentSourceLocation) { async function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storageResolver, currentSourceLocation) {
var scope = internalTreeCall.findScope(vmtraceIndex) var scope = internalTreeCall.findScope(vmtraceIndex)
if (!scope) { if (!scope) {
var error = { 'message': 'Can\'t display locals. reason: compilation result might not have been provided' } var error = { 'message': 'Can\'t display locals. reason: compilation result might not have been provided' }
...@@ -17,7 +17,7 @@ function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storageR ...@@ -17,7 +17,7 @@ function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storageR
name = '<' + anonymousIncr + '>' name = '<' + anonymousIncr + '>'
anonymousIncr++ anonymousIncr++
} }
locals[name] = variable.type.decodeFromStack(variable.stackDepth, stack, memory, storageResolver) locals[name] = await variable.type.decodeFromStack(variable.stackDepth, stack, memory, storageResolver)
} }
} }
return locals return locals
......
...@@ -12,8 +12,8 @@ class StringType extends DynamicBytes { ...@@ -12,8 +12,8 @@ class StringType extends DynamicBytes {
return format(decoded) return format(decoded)
} }
decodeFromStack (stackDepth, stack, memory) { async decodeFromStack (stackDepth, stack, memory) {
return super.decodeFromStack(stackDepth, stack, memory) return await super.decodeFromStack(stackDepth, stack, memory)
} }
decodeFromMemoryInternal (offset, memory) { decodeFromMemoryInternal (offset, memory) {
......
...@@ -32,7 +32,7 @@ class ValueType { ...@@ -32,7 +32,7 @@ class ValueType {
* @param {String} - memory * @param {String} - memory
* @return {Object} - decoded value * @return {Object} - decoded value
*/ */
decodeFromStack (stackDepth, stack, memory) { async decodeFromStack (stackDepth, stack, memory) {
var value var value
if (stackDepth >= stack.length) { if (stackDepth >= stack.length) {
value = this.decodeValue('') value = this.decodeValue('')
......
...@@ -41,8 +41,11 @@ class SolidityLocals { ...@@ -41,8 +41,11 @@ class SolidityLocals {
var stack = result[0].value var stack = result[0].value
var memory = result[1].value var memory = result[1].value
try { try {
var locals = localDecoder.solidityLocals(this.parent.currentStepIndex, this.internalTreeCall, stack, memory, this.storageResolver, sourceLocation) localDecoder.solidityLocals(this.parent.currentStepIndex, this.internalTreeCall, stack, memory, this.storageResolver, sourceLocation).then((locals) => {
this.basicPanel.update(locals) if (!result.error) {
this.basicPanel.update(locals)
}
})
} catch (e) { } catch (e) {
warningDiv.innerHTML = e.message warningDiv.innerHTML = e.message
} }
......
...@@ -12,8 +12,9 @@ function decodeLocal (st, index, traceManager, callTree, verifier) { ...@@ -12,8 +12,9 @@ function decodeLocal (st, index, traceManager, callTree, verifier) {
index, index,
function (error, result) { function (error, result) {
if (!error) { if (!error) {
var locals = localDecoder.solidityLocals(index, callTree, result[0].value, result[1].value, {}, {start: 5000}) localDecoder.solidityLocals(index, callTree, result[0].value, result[1].value, {}, {start: 5000}).then((locals) => {
verifier(locals) verifier(locals)
})
} else { } else {
st.fail(error) st.fail(error)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment