Commit 972397e8 authored by chriseth's avatar chriseth Committed by GitHub

Merge branch 'master' into hidelocalsiffuncscope

parents 90403995 e6798dea
...@@ -254,12 +254,13 @@ function getStructMembers (type, stateDefinitions, contractName, location) { ...@@ -254,12 +254,13 @@ function getStructMembers (type, stateDefinitions, contractName, location) {
* @return {String} returns the token type (used to instanciate the right decoder) (uint[2] storage ref[2] will return 'array', uint256 will return uintX) * @return {String} returns the token type (used to instanciate the right decoder) (uint[2] storage ref[2] will return 'array', uint256 will return uintX)
*/ */
function typeClass (fullType) { function typeClass (fullType) {
fullType = util.removeLocation(fullType)
if (fullType.lastIndexOf(']') === fullType.length - 1) {
return 'array'
}
if (fullType.indexOf('mapping') === 0) { if (fullType.indexOf('mapping') === 0) {
return 'mapping' return 'mapping'
} }
if (fullType.indexOf(']') !== -1) {
return 'array'
}
if (fullType.indexOf(' ') !== -1) { if (fullType.indexOf(' ') !== -1) {
fullType = fullType.split(' ')[0] fullType = fullType.split(' ')[0]
} }
......
...@@ -8,10 +8,16 @@ function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storage, ...@@ -8,10 +8,16 @@ function solidityLocals (vmtraceIndex, internalTreeCall, stack, memory, storage,
} }
var locals = {} var locals = {}
memory = formatMemory(memory) memory = formatMemory(memory)
var anonymousIncr = 1
for (var local in scope.locals) { for (var local in scope.locals) {
let variable = scope.locals[local] let variable = scope.locals[local]
if (variable.stackDepth < stack.length && variable.sourceLocation.start <= currentSourceLocation.start) { if (variable.stackDepth < stack.length && variable.sourceLocation.start <= currentSourceLocation.start) {
locals[variable.name] = variable.type.decodeFromStack(variable.stackDepth, stack, memory, storage) var name = variable.name
if (name === '') {
name = '<' + anonymousIncr + '>'
anonymousIncr++
}
locals[name] = variable.type.decodeFromStack(variable.stackDepth, stack, memory, storage)
} }
} }
return locals return locals
......
...@@ -11,7 +11,8 @@ module.exports = { ...@@ -11,7 +11,8 @@ module.exports = {
sha3: sha3, sha3: sha3,
toBN: toBN, toBN: toBN,
add: add, add: add,
extractLocation: extractLocation extractLocation: extractLocation,
removeLocation: removeLocation
} }
function decodeInt (location, storageContent, byteLength, signed) { function decodeInt (location, storageContent, byteLength, signed) {
...@@ -93,6 +94,10 @@ function add (value1, value2) { ...@@ -93,6 +94,10 @@ function add (value1, value2) {
return toBN(value1).add(toBN(value2)) return toBN(value1).add(toBN(value2))
} }
function removeLocation (type) {
return type.replace(/( storage ref| storage pointer| memory| calldata)/g, '')
}
function extractLocation (type) { function extractLocation (type) {
var match = type.match(/( storage ref| storage pointer| memory| calldata)?$/) var match = type.match(/( storage ref| storage pointer| memory| calldata)?$/)
if (match[1] !== '') { if (match[1] !== '') {
......
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