fix local (add async)

pull/7/head
yann300 8 years ago
parent 7a3b7d89a7
commit 05645cb556
  1. 4
      src/solidity/localDecoder.js
  2. 4
      src/solidity/types/StringType.js
  3. 2
      src/solidity/types/ValueType.js
  4. 7
      src/ui/SolidityLocals.js
  5. 5
      test/solidity/localsTests/helper.js

@ -1,6 +1,6 @@
'use strict'
function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storageResolver, currentSourceLocation) {
async function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storageResolver, currentSourceLocation) {
var scope = internalTreeCall.findScope(vmtraceIndex)
if (!scope) {
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
name = '<' + 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

@ -12,8 +12,8 @@ class StringType extends DynamicBytes {
return format(decoded)
}
decodeFromStack (stackDepth, stack, memory) {
return super.decodeFromStack(stackDepth, stack, memory)
async decodeFromStack (stackDepth, stack, memory) {
return await super.decodeFromStack(stackDepth, stack, memory)
}
decodeFromMemoryInternal (offset, memory) {

@ -32,7 +32,7 @@ class ValueType {
* @param {String} - memory
* @return {Object} - decoded value
*/
decodeFromStack (stackDepth, stack, memory) {
async decodeFromStack (stackDepth, stack, memory) {
var value
if (stackDepth >= stack.length) {
value = this.decodeValue('')

@ -41,8 +41,11 @@ class SolidityLocals {
var stack = result[0].value
var memory = result[1].value
try {
var locals = localDecoder.solidityLocals(this.parent.currentStepIndex, this.internalTreeCall, stack, memory, this.storageResolver, sourceLocation)
this.basicPanel.update(locals)
localDecoder.solidityLocals(this.parent.currentStepIndex, this.internalTreeCall, stack, memory, this.storageResolver, sourceLocation).then((locals) => {
if (!result.error) {
this.basicPanel.update(locals)
}
})
} catch (e) {
warningDiv.innerHTML = e.message
}

@ -12,8 +12,9 @@ function decodeLocal (st, index, traceManager, callTree, verifier) {
index,
function (error, result) {
if (!error) {
var locals = localDecoder.solidityLocals(index, callTree, result[0].value, result[1].value, {}, {start: 5000})
verifier(locals)
localDecoder.solidityLocals(index, callTree, result[0].value, result[1].value, {}, {start: 5000}).then((locals) => {
verifier(locals)
})
} else {
st.fail(error)
}

Loading…
Cancel
Save