|
|
@ -46,6 +46,9 @@ export class InternalCallTree { |
|
|
|
pendingConstructorId: number |
|
|
|
pendingConstructorId: number |
|
|
|
pendingConstructor |
|
|
|
pendingConstructor |
|
|
|
constructorsStartExecution |
|
|
|
constructorsStartExecution |
|
|
|
|
|
|
|
variables: { |
|
|
|
|
|
|
|
[Key: number]: any |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* constructor |
|
|
|
* constructor |
|
|
@ -122,6 +125,7 @@ export class InternalCallTree { |
|
|
|
this.pendingConstructorId = -1 |
|
|
|
this.pendingConstructorId = -1 |
|
|
|
this.constructorsStartExecution = {} |
|
|
|
this.constructorsStartExecution = {} |
|
|
|
this.pendingConstructor = null |
|
|
|
this.pendingConstructor = null |
|
|
|
|
|
|
|
this.variables = {} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -203,6 +207,10 @@ export class InternalCallTree { |
|
|
|
} |
|
|
|
} |
|
|
|
throw new Error('Could not find gas cost per line') |
|
|
|
throw new Error('Could not find gas cost per line') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getLocalVariableById (id: number) { |
|
|
|
|
|
|
|
return this.variables[id] |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function buildTree (tree, step, scopeId, isCreation, functionDefinition?, contractObj?, sourceLocation?, validSourceLocation?) { |
|
|
|
async function buildTree (tree, step, scopeId, isCreation, functionDefinition?, contractObj?, sourceLocation?, validSourceLocation?) { |
|
|
@ -407,12 +415,14 @@ async function includeVariableDeclaration (tree, step, sourceLocation, scopeId, |
|
|
|
let location = extractLocationFromAstVariable(variableDeclaration) |
|
|
|
let location = extractLocationFromAstVariable(variableDeclaration) |
|
|
|
location = location === 'default' ? 'storage' : location |
|
|
|
location = location === 'default' ? 'storage' : location |
|
|
|
// we push the new local variable in our tree
|
|
|
|
// we push the new local variable in our tree
|
|
|
|
tree.scopes[scopeId].locals[variableDeclaration.name] = { |
|
|
|
const newVar = { |
|
|
|
name: variableDeclaration.name, |
|
|
|
name: variableDeclaration.name, |
|
|
|
type: parseType(variableDeclaration.typeDescriptions.typeString, states, contractObj.name, location), |
|
|
|
type: parseType(variableDeclaration.typeDescriptions.typeString, states, contractObj.name, location), |
|
|
|
stackDepth: stack.length, |
|
|
|
stackDepth: stack.length, |
|
|
|
sourceLocation: sourceLocation |
|
|
|
sourceLocation: sourceLocation |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
tree.scopes[scopeId].locals[variableDeclaration.name] = newVar |
|
|
|
|
|
|
|
tree.variables[variableDeclaration.id] = newVar |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
} catch (error) { |
|
|
|
console.log(error) |
|
|
|
console.log(error) |
|
|
|