|
|
|
@ -228,8 +228,8 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc |
|
|
|
|
const stack = tree.traceManager.getStackAt(step) |
|
|
|
|
// the stack length at this point is where the value of the new local variable will be stored.
|
|
|
|
|
// so, either this is the direct value, or the offset in memory. That depends on the type.
|
|
|
|
|
tree.solidityProxy.contractNameAt(step, (error, contractName) => { // cached
|
|
|
|
|
if (!error && variableDeclaration.attributes.name !== '') { |
|
|
|
|
tree.solidityProxy.contractNameAt(step).then((contractName) => { |
|
|
|
|
if (variableDeclaration.attributes.name !== '') { |
|
|
|
|
var states = tree.solidityProxy.extractStatesDefinitions() |
|
|
|
|
var location = typesUtil.extractLocationFromAstVariable(variableDeclaration) |
|
|
|
|
location = location === 'default' ? 'storage' : location |
|
|
|
@ -242,7 +242,7 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} catch (error) { |
|
|
|
|
} catch (_error) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// we check here if we are at the beginning inside a new function.
|
|
|
|
@ -254,32 +254,30 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc |
|
|
|
|
// means: the previous location was a function definition && JUMPDEST
|
|
|
|
|
// => we are at the beginning of the function and input/output are setup
|
|
|
|
|
|
|
|
|
|
tree.solidityProxy.contractNameAt(step, (error, contractName) => { // cached
|
|
|
|
|
if (!error) { |
|
|
|
|
try { |
|
|
|
|
const stack = tree.traceManager.getStackAt(step) |
|
|
|
|
var states = tree.solidityProxy.extractStatesDefinitions() |
|
|
|
|
if (functionDefinition.children && functionDefinition.children.length) { |
|
|
|
|
let inputs |
|
|
|
|
let outputs |
|
|
|
|
for (const element of functionDefinition.children) { |
|
|
|
|
if (element.name === 'ParameterList') { |
|
|
|
|
if (!inputs) inputs = element |
|
|
|
|
else { |
|
|
|
|
outputs = element |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
tree.solidityProxy.contractNameAt(step).then((contractName) => { // cached
|
|
|
|
|
try { |
|
|
|
|
const stack = tree.traceManager.getStackAt(step) |
|
|
|
|
var states = tree.solidityProxy.extractStatesDefinitions() |
|
|
|
|
if (functionDefinition.children && functionDefinition.children.length) { |
|
|
|
|
let inputs |
|
|
|
|
let outputs |
|
|
|
|
for (const element of functionDefinition.children) { |
|
|
|
|
if (element.name === 'ParameterList') { |
|
|
|
|
if (!inputs) inputs = element |
|
|
|
|
else { |
|
|
|
|
outputs = element |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// input params
|
|
|
|
|
if (inputs) { |
|
|
|
|
functionDefinitionAndInputs.inputs = addParams(inputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, inputs.children.length, -1) |
|
|
|
|
} |
|
|
|
|
// output params
|
|
|
|
|
if (outputs) addParams(outputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, 0, 1) |
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
// input params
|
|
|
|
|
if (inputs) { |
|
|
|
|
functionDefinitionAndInputs.inputs = addParams(inputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, inputs.children.length, -1) |
|
|
|
|
} |
|
|
|
|
// output params
|
|
|
|
|
if (outputs) addParams(outputs, tree, scopeId, states, contractName, previousSourceLocation, stack.length, 0, 1) |
|
|
|
|
} |
|
|
|
|
} catch (_error) { |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|