move global vars out of debugger logic

pull/1/head
Iuri Matias 6 years ago committed by yann300
parent 98e3a498c1
commit b192a3df8c
  1. 19
      src/app/debugger/debugger.js
  2. 30
      src/app/debugger/debuggerUI.js

@ -2,10 +2,8 @@
var Ethdebugger = require('remix-debug').EthDebugger
var remixLib = require('remix-lib')
var EventManager = remixLib.EventManager
var executionContext = require('../../execution-context')
var globalRegistry = require('../../global/registry')
function Debugger () {
function Debugger (options) {
var self = this
this.event = new EventManager()
@ -22,7 +20,7 @@ function Debugger () {
}
this.debugger = new Ethdebugger(
{
executionContext: executionContext,
executionContext: this.executionContext,
compilationResult: () => {
if (this._deps.compilersArtefacts['__last']) return this._deps.compilersArtefacts['__last'].getData()
return null
@ -37,8 +35,9 @@ function Debugger () {
this.debugger.setBreakpointManager(this.breakPointManager)
executionContext.event.register('contextChanged', this, function (context) {
self.switchProvider(context)
this.executionContext.event.register('contextChanged', this, function (context) {
// TODO: was already broken
//self.switchProvider(context)
})
this.debugger.event.register('newTraceLoaded', this, function () {
@ -49,10 +48,10 @@ function Debugger () {
self.event.trigger('debuggerStatus', [false])
})
this.debugger.addProvider('vm', executionContext.vm())
this.debugger.addProvider('injected', executionContext.internalWeb3())
this.debugger.addProvider('web3', executionContext.internalWeb3())
this.debugger.switchProvider(executionContext.getProvider())
this.debugger.addProvider('vm', this.executionContext.vm())
this.debugger.addProvider('injected', this.executionContext.internalWeb3())
this.debugger.addProvider('web3', this.executionContext.internalWeb3())
this.debugger.switchProvider(this.executionContext.getProvider())
}
Debugger.prototype.registerAndHighlightCodeItem = function (index) {

@ -8,12 +8,12 @@ var StepManager = require('./stepManager')
var SourceHighlighter = require('../editor/sourceHighlighter')
var remixLib = require('remix-lib')
var executionContext = remixLib.execution.executionContext
var EventManager = remixLib.EventManager
var traceHelper = remixLib.helpers.trace
var VmDebuggerLogic = require('./VmDebugger')
var executionContext = require('../../execution-context')
var globalRegistry = require('../../global/registry')
var yo = require('yo-yo')
@ -34,12 +34,21 @@ class DebuggerUI {
constructor (container) {
const self = this
this.sourceHighlighter = new SourceHighlighter()
this.transactionDebugger = new Debugger(this.sourceHighlighter)
this.registry = globalRegistry
this.event = new EventManager()
this.setupExecutionContext()
this.transactionDebugger = new Debugger({
executionContext: executionContext,
offsetToLineColumnConverter: this.registry.get('offsettolinecolumnconverter').api,
compiler: this.registry.get('compiler').api
})
this.debugger = this.transactionDebugger.debugger
this.isActive = false
this.event = new EventManager()
this.sourceHighlighter = new SourceHighlighter()
this.startTxBrowser()
// this.startStepManager()
@ -61,11 +70,22 @@ class DebuggerUI {
container.appendChild(this.render())
this.registry = globalRegistry
this.setEditor()
this.listenToEvents()
}
setupExecutionContext () {
this.executionContext.event.register('contextChanged', this, function (context) {
// TODO: was already broken
//self.switchProvider(context)
})
this.debugger.addProvider('vm', this.executionContext.vm())
this.debugger.addProvider('injected', this.executionContext.internalWeb3())
this.debugger.addProvider('web3', this.executionContext.internalWeb3())
this.debugger.switchProvider(this.executionContext.getProvider())
}
setEditor () {
const self = this
this.editor = this.registry.get('editor').api

Loading…
Cancel
Save