Merge fetched locals

pull/479/head
ioedeveloper 4 years ago
parent 724761d2ea
commit 6fc8376028
  1. 3
      apps/remix-ide/src/app/tabs/debugger/debuggerUI/VmDebugger.js
  2. 17
      apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/SolidityLocals.js
  3. 1
      apps/remix-ide/src/app/tabs/debugger/debuggerUI/vmDebugger/utils/SolidityTypeFormatter.js
  4. 3
      libs/remix-debug/src/debugger/VmDebugger.js
  5. 6
      libs/remix-debug/src/debugger/solidityLocals.js

@ -83,6 +83,9 @@ function VmDebugger (vmDebuggerLogic) {
this.vmDebuggerLogic.event.register('solidityStateUpdating', this.solidityState.setUpdating.bind(this.solidityState))
this.solidityLocals = new SolidityLocals(vmDebuggerLogic)
this.solidityLocals.event.register('solidityLocalsLoadMore', (cursor) => {
this.vmDebuggerLogic.event.trigger('solidityLocalsLoadMore', [cursor])
})
this.vmDebuggerLogic.event.register('solidityLocals', this.solidityLocals.update.bind(this.solidityLocals))
this.vmDebuggerLogic.event.register('solidityLocalsMessage', this.solidityLocals.setMessage.bind(this.solidityLocals))
this.vmDebuggerLogic.event.register('solidityLocalsUpdating', this.solidityLocals.setUpdating.bind(this.solidityLocals))

@ -3,18 +3,18 @@ var EventManager = require('../../../../../lib/events')
var DropdownPanel = require('./DropdownPanel')
var solidityTypeFormatter = require('./utils/SolidityTypeFormatter')
var yo = require('yo-yo')
var deepequal = require('deep-equal')
class SolidityLocals {
constructor (vmDebuggerLogic) {
constructor () {
this.event = new EventManager()
this.basicPanel = new DropdownPanel('Solidity Locals', {
json: true,
formatSelf: solidityTypeFormatter.formatSelf,
extractData: solidityTypeFormatter.extractData,
loadMore: (cursor) => {
console.log('cursor: ', cursor)
vmDebuggerLogic.event.trigger('solidityLocalsLoadMore', [cursor])
this.event.trigger('solidityLocalsLoadMore', [cursor])
}
})
this.view
@ -41,9 +41,14 @@ class SolidityLocals {
}
mergeLocals (locals1, locals2) {
console.log('locals1: ', locals1)
console.log('locals2: ', locals2)
return {}
Object.keys(locals2).map(item => {
if (!deepequal(locals2[item], locals1[item])) {
if (locals2[item].cursor) {
locals2[item].value = [...locals2[item].value, ...locals1[item].value]
}
}
})
return locals2
}
render () {

@ -53,7 +53,6 @@ function extractData (item, parent, key) {
ret.self = item.value
ret.type = item.type
}
if(ret.hasNext) console.log('return value: ', ret)
return ret
}

@ -229,6 +229,9 @@ class VmDebuggerLogic {
listenToSolidityLocalsEvents () {
this.event.register('sourceLocationChanged', this.debuggerSolidityLocals.init.bind(this.debuggerSolidityLocals))
this.event.register('solidityLocalsLoadMore', this.debuggerSolidityLocals.decodeMore.bind(this.debuggerSolidityLocals))
this.debuggerSolidityLocals.event.register('solidityLocalsLoadMoreCompleted', (locals) => {
this.event.trigger('solidityLocalsLoadMoreCompleted', [locals])
})
this.debuggerSolidityLocals.event.register('solidityLocals', (state) => {
this.event.trigger('solidityLocals', [state])
})

@ -86,14 +86,12 @@ class DebuggerSolidityLocals {
})
}
decodeMore () {
console.log('called and works!')
decodeMore (cursor) {
let decodeTimeout = null
if (!this.storageResolver) return this.event.trigger('solidityLocalsMessage', ['storage not ready'])
if (decodeTimeout) window.clearTimeout(decodeTimeout)
this.event.trigger('solidityLocalsUpdating')
decodeTimeout = setTimeout(() => {
this.decode(this._sourceLocation)
this.decode(this._sourceLocation, cursor)
}, 500)
}

Loading…
Cancel
Save