Merge fetched locals

pull/5370/head
ioedeveloper 4 years ago
parent 6a6e3c54c2
commit 54815ce50e
  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.vmDebuggerLogic.event.register('solidityStateUpdating', this.solidityState.setUpdating.bind(this.solidityState))
this.solidityLocals = new SolidityLocals(vmDebuggerLogic) 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('solidityLocals', this.solidityLocals.update.bind(this.solidityLocals))
this.vmDebuggerLogic.event.register('solidityLocalsMessage', this.solidityLocals.setMessage.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)) 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 DropdownPanel = require('./DropdownPanel')
var solidityTypeFormatter = require('./utils/SolidityTypeFormatter') var solidityTypeFormatter = require('./utils/SolidityTypeFormatter')
var yo = require('yo-yo') var yo = require('yo-yo')
var deepequal = require('deep-equal')
class SolidityLocals { class SolidityLocals {
constructor (vmDebuggerLogic) { constructor () {
this.event = new EventManager() this.event = new EventManager()
this.basicPanel = new DropdownPanel('Solidity Locals', { this.basicPanel = new DropdownPanel('Solidity Locals', {
json: true, json: true,
formatSelf: solidityTypeFormatter.formatSelf, formatSelf: solidityTypeFormatter.formatSelf,
extractData: solidityTypeFormatter.extractData, extractData: solidityTypeFormatter.extractData,
loadMore: (cursor) => { loadMore: (cursor) => {
console.log('cursor: ', cursor) this.event.trigger('solidityLocalsLoadMore', [cursor])
vmDebuggerLogic.event.trigger('solidityLocalsLoadMore', [cursor])
} }
}) })
this.view this.view
@ -41,9 +41,14 @@ class SolidityLocals {
} }
mergeLocals (locals1, locals2) { mergeLocals (locals1, locals2) {
console.log('locals1: ', locals1) Object.keys(locals2).map(item => {
console.log('locals2: ', locals2) if (!deepequal(locals2[item], locals1[item])) {
return {} if (locals2[item].cursor) {
locals2[item].value = [...locals2[item].value, ...locals1[item].value]
}
}
})
return locals2
} }
render () { render () {

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

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

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

Loading…
Cancel
Save