Commit 422ac5cb authored by yann300's avatar yann300

rename contractsDetail contracts

parent dc2574e7
...@@ -20,11 +20,11 @@ function SourceLocationTracker (_codeManager) { ...@@ -20,11 +20,11 @@ function SourceLocationTracker (_codeManager) {
* @param {Object} contractDetails - AST of compiled contracts * @param {Object} contractDetails - AST of compiled contracts
* @param {Function} cb - callback function * @param {Function} cb - callback function
*/ */
SourceLocationTracker.prototype.getSourceLocation = function (address, index, contractsDetails, cb) { SourceLocationTracker.prototype.getSourceLocation = function (address, index, contracts, cb) {
var self = this var self = this
this.codeManager.getCode(address, function (error, result) { this.codeManager.getCode(address, function (error, result) {
if (!error) { if (!error) {
var sourceMap = getSourceMap(address, result.bytecode, contractsDetails) var sourceMap = getSourceMap(address, result.bytecode, contracts)
if (sourceMap) { if (sourceMap) {
cb(null, self.sourceMappingDecoder.atIndex(index, sourceMap)) cb(null, self.sourceMappingDecoder.atIndex(index, sourceMap))
} else { } else {
...@@ -44,11 +44,11 @@ SourceLocationTracker.prototype.getSourceLocation = function (address, index, co ...@@ -44,11 +44,11 @@ SourceLocationTracker.prototype.getSourceLocation = function (address, index, co
* @param {Object} contractDetails - AST of compiled contracts * @param {Object} contractDetails - AST of compiled contracts
* @param {Function} cb - callback function * @param {Function} cb - callback function
*/ */
SourceLocationTracker.prototype.getSourceLocation = function (address, vmtraceStepIndex, contractsDetails, cb) { SourceLocationTracker.prototype.getSourceLocation = function (address, vmtraceStepIndex, contracts, cb) {
var self = this var self = this
this.codeManager.getCode(address, function (error, result) { this.codeManager.getCode(address, function (error, result) {
if (!error) { if (!error) {
var sourceMap = getSourceMap(address, result.bytecode, contractsDetails) var sourceMap = getSourceMap(address, result.bytecode, contracts)
if (sourceMap) { if (sourceMap) {
self.codeManager.getInstructionIndex(address, vmtraceStepIndex, function (error, index) { self.codeManager.getInstructionIndex(address, vmtraceStepIndex, function (error, index) {
if (error) { if (error) {
...@@ -73,12 +73,12 @@ function srcmapRuntime (contract) { ...@@ -73,12 +73,12 @@ function srcmapRuntime (contract) {
return contract.srcmapRuntime ? contract.srcmapRuntime : contract['srcmap-runtime'] return contract.srcmapRuntime ? contract.srcmapRuntime : contract['srcmap-runtime']
} }
function getSourceMap (address, code, contractsDetails) { function getSourceMap (address, code, contracts) {
var isCreation = helper.isContractCreation(address) var isCreation = helper.isContractCreation(address)
var byteProp = isCreation ? 'bytecode' : 'runtimeBytecode' var byteProp = isCreation ? 'bytecode' : 'runtimeBytecode'
for (var k in contractsDetails) { for (var k in contracts) {
if ('0x' + contractsDetails[k][byteProp] === code) { if ('0x' + contracts[k][byteProp] === code) {
return isCreation ? contractsDetails[k].srcmap : srcmapRuntime(contractsDetails[k]) return isCreation ? contracts[k].srcmap : srcmapRuntime(contracts[k])
} }
} }
return null return null
......
...@@ -5,7 +5,7 @@ var decodeInfo = require('../solidity/decodeInfo') ...@@ -5,7 +5,7 @@ var decodeInfo = require('../solidity/decodeInfo')
function LocalDecoder (parent, codeManager, traceAnalyserEvent) { function LocalDecoder (parent, codeManager, traceAnalyserEvent) {
this.astWalker = new AstWalker() this.astWalker = new AstWalker()
this.codeManager = this.codeManager this.codeManager = codeManager
this.parent = parent this.parent = parent
this.locals = {} this.locals = {}
this.loading = false this.loading = false
...@@ -26,7 +26,7 @@ LocalDecoder.prototype.push = function (index, step, callStack, cache) { ...@@ -26,7 +26,7 @@ LocalDecoder.prototype.push = function (index, step, callStack, cache) {
if (!this.parent.sources) return if (!this.parent.sources) return
if (step.op.indexOf('PUSH') === 0) { if (step.op.indexOf('PUSH') === 0) {
var self = this var self = this
var compiledContracts = this.parent.contractsDetail var compiledContracts = this.parent.contracts
var address = callStack[callStack.length - 1] var address = callStack[callStack.length - 1]
this.sourceLocationTracker.getSourceLocation(address, index, compiledContracts, function (error, result) { this.sourceLocationTracker.getSourceLocation(address, index, compiledContracts, function (error, result) {
if (error) { if (error) {
......
...@@ -20,7 +20,7 @@ function Ethdebugger () { ...@@ -20,7 +20,7 @@ function Ethdebugger () {
this.currentStepIndex = -1 this.currentStepIndex = -1
this.tx this.tx
this.sources this.sources
this.contractsDetail this.contracts
this.statusMessage = '' this.statusMessage = ''
this.view this.view
...@@ -79,10 +79,10 @@ Ethdebugger.prototype.setCompilationResult = function (compilationResult) { ...@@ -79,10 +79,10 @@ Ethdebugger.prototype.setCompilationResult = function (compilationResult) {
if (compilationResult && compilationResult.sources && compilationResult.contracts) { if (compilationResult && compilationResult.sources && compilationResult.contracts) {
this.sources = compilationResult.sources this.sources = compilationResult.sources
this.sourceList = compilationResult.sourceList this.sourceList = compilationResult.sourceList
this.contractsDetail = compilationResult.contracts this.contracts = compilationResult.contracts
} else { } else {
this.sources = null this.sources = null
this.contractsDetail = null this.contracts = null
this.sourceList = null this.sourceList = null
} }
} }
......
...@@ -24,7 +24,7 @@ SolidityState.prototype.init = function () { ...@@ -24,7 +24,7 @@ SolidityState.prototype.init = function () {
return return
} }
if (self.parent.currentStepIndex !== index) return if (self.parent.currentStepIndex !== index) return
if (!this.parent.contractsDetail || !this.parent.sources) { if (!this.parent.contracts || !this.parent.sources) {
self.basicPanel.update({info: 'no source has been specified'}) self.basicPanel.update({info: 'no source has been specified'})
return return
} }
...@@ -41,7 +41,7 @@ SolidityState.prototype.init = function () { ...@@ -41,7 +41,7 @@ SolidityState.prototype.init = function () {
if (error) { if (error) {
self.basicPanel.update({ info: error }) self.basicPanel.update({ info: error })
} else { } else {
var contractName = contractNameFromCode(self.parent.contractsDetail, code.bytecode, address) var contractName = contractNameFromCode(self.parent.contracts, code.bytecode, address)
if (contractName === null) { if (contractName === null) {
self.basicPanel.update({ info: 'could not find compiled contract with address ' + address }) self.basicPanel.update({ info: 'could not find compiled contract with address ' + address })
} else { } else {
......
...@@ -15,7 +15,7 @@ var util = require('../../src/helpers/global') ...@@ -15,7 +15,7 @@ var util = require('../../src/helpers/global')
var LocalDecoder = require('../../src/solidity/localDecoder') var LocalDecoder = require('../../src/solidity/localDecoder')
tape('solidity', function (t) { tape('solidity', function (t) {
t.test('storage decoder', function (st) { t.test('local decoder', function (st) {
var privateKey = new Buffer('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex') var privateKey = new Buffer('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex')
var address = utileth.privateToAddress(privateKey) var address = utileth.privateToAddress(privateKey)
var vm = initVM(st, address) var vm = initVM(st, address)
......
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