rename contractsDetail contracts

pull/7/head
yann300 8 years ago
parent e5a0f2c056
commit 85de091767
  1. 16
      src/code/sourceLocationTracker.js
  2. 4
      src/solidity/localDecoder.js
  3. 6
      src/ui/Ethdebugger.js
  4. 4
      src/ui/SolidityState.js
  5. 2
      test/solidity/localDecoder.js

@ -20,11 +20,11 @@ function SourceLocationTracker (_codeManager) {
* @param {Object} contractDetails - AST of compiled contracts
* @param {Function} cb - callback function
*/
SourceLocationTracker.prototype.getSourceLocation = function (address, index, contractsDetails, cb) {
SourceLocationTracker.prototype.getSourceLocation = function (address, index, contracts, cb) {
var self = this
this.codeManager.getCode(address, function (error, result) {
if (!error) {
var sourceMap = getSourceMap(address, result.bytecode, contractsDetails)
var sourceMap = getSourceMap(address, result.bytecode, contracts)
if (sourceMap) {
cb(null, self.sourceMappingDecoder.atIndex(index, sourceMap))
} else {
@ -44,11 +44,11 @@ SourceLocationTracker.prototype.getSourceLocation = function (address, index, co
* @param {Object} contractDetails - AST of compiled contracts
* @param {Function} cb - callback function
*/
SourceLocationTracker.prototype.getSourceLocation = function (address, vmtraceStepIndex, contractsDetails, cb) {
SourceLocationTracker.prototype.getSourceLocation = function (address, vmtraceStepIndex, contracts, cb) {
var self = this
this.codeManager.getCode(address, function (error, result) {
if (!error) {
var sourceMap = getSourceMap(address, result.bytecode, contractsDetails)
var sourceMap = getSourceMap(address, result.bytecode, contracts)
if (sourceMap) {
self.codeManager.getInstructionIndex(address, vmtraceStepIndex, function (error, index) {
if (error) {
@ -73,12 +73,12 @@ function srcmapRuntime (contract) {
return contract.srcmapRuntime ? contract.srcmapRuntime : contract['srcmap-runtime']
}
function getSourceMap (address, code, contractsDetails) {
function getSourceMap (address, code, contracts) {
var isCreation = helper.isContractCreation(address)
var byteProp = isCreation ? 'bytecode' : 'runtimeBytecode'
for (var k in contractsDetails) {
if ('0x' + contractsDetails[k][byteProp] === code) {
return isCreation ? contractsDetails[k].srcmap : srcmapRuntime(contractsDetails[k])
for (var k in contracts) {
if ('0x' + contracts[k][byteProp] === code) {
return isCreation ? contracts[k].srcmap : srcmapRuntime(contracts[k])
}
}
return null

@ -5,7 +5,7 @@ var decodeInfo = require('../solidity/decodeInfo')
function LocalDecoder (parent, codeManager, traceAnalyserEvent) {
this.astWalker = new AstWalker()
this.codeManager = this.codeManager
this.codeManager = codeManager
this.parent = parent
this.locals = {}
this.loading = false
@ -26,7 +26,7 @@ LocalDecoder.prototype.push = function (index, step, callStack, cache) {
if (!this.parent.sources) return
if (step.op.indexOf('PUSH') === 0) {
var self = this
var compiledContracts = this.parent.contractsDetail
var compiledContracts = this.parent.contracts
var address = callStack[callStack.length - 1]
this.sourceLocationTracker.getSourceLocation(address, index, compiledContracts, function (error, result) {
if (error) {

@ -20,7 +20,7 @@ function Ethdebugger () {
this.currentStepIndex = -1
this.tx
this.sources
this.contractsDetail
this.contracts
this.statusMessage = ''
this.view
@ -79,10 +79,10 @@ Ethdebugger.prototype.setCompilationResult = function (compilationResult) {
if (compilationResult && compilationResult.sources && compilationResult.contracts) {
this.sources = compilationResult.sources
this.sourceList = compilationResult.sourceList
this.contractsDetail = compilationResult.contracts
this.contracts = compilationResult.contracts
} else {
this.sources = null
this.contractsDetail = null
this.contracts = null
this.sourceList = null
}
}

@ -24,7 +24,7 @@ SolidityState.prototype.init = function () {
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'})
return
}
@ -41,7 +41,7 @@ SolidityState.prototype.init = function () {
if (error) {
self.basicPanel.update({ info: error })
} else {
var contractName = contractNameFromCode(self.parent.contractsDetail, code.bytecode, address)
var contractName = contractNameFromCode(self.parent.contracts, code.bytecode, address)
if (contractName === null) {
self.basicPanel.update({ info: 'could not find compiled contract with address ' + address })
} else {

@ -15,7 +15,7 @@ var util = require('../../src/helpers/global')
var LocalDecoder = require('../../src/solidity/localDecoder')
tape('solidity', function (t) {
t.test('storage decoder', function (st) {
t.test('local decoder', function (st) {
var privateKey = new Buffer('dae9801649ba2d95a21e688b56f77905e5667c44ce868ec83f82e838712a2c7a', 'hex')
var address = utileth.privateToAddress(privateKey)
var vm = initVM(st, address)

Loading…
Cancel
Save