move initializations of execution context

pull/7/head
Iuri Matias 6 years ago
parent 0d2d4055c4
commit baafc7803a
  1. 15
      remix-debug/src/debugger/debugger.js

@ -7,20 +7,17 @@ var traceHelper = remixLib.helpers.trace
var StepManager = require('./stepManager') var StepManager = require('./stepManager')
var VmDebuggerLogic = require('./VmDebugger') var VmDebuggerLogic = require('./VmDebugger')
var Web3Providers = remixLib.vm.Web3Providers
var DummyProvider = remixLib.vm.DummyProvider
var init = remixLib.init var init = remixLib.init
function Debugger (options) { function Debugger (options) {
var self = this var self = this
this.event = new EventManager() this.event = new EventManager()
this.executionContext = options.executionContext
this.offsetToLineColumnConverter = options.offsetToLineColumnConverter this.offsetToLineColumnConverter = options.offsetToLineColumnConverter
this.compiler = options.compiler this.compiler = options.compiler
this.debugger = new Ethdebugger({ this.debugger = new Ethdebugger({
web3: this.executionContext.web3, web3: options.web3,
compilationResult: () => { compilationResult: () => {
var compilationResult = this.compiler.lastCompilationResult var compilationResult = this.compiler.lastCompilationResult
if (compilationResult) { if (compilationResult) {
@ -30,10 +27,6 @@ function Debugger (options) {
} }
}) })
this.web3Providers = new Web3Providers()
this.addProvider('DUMMYWEB3', new DummyProvider())
this.switchProvider('DUMMYWEB3')
this.breakPointManager = new remixLib.code.BreakpointManager(this.debugger, (sourceLocation) => { this.breakPointManager = new remixLib.code.BreakpointManager(this.debugger, (sourceLocation) => {
return self.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, this.compiler.lastCompilationResult.source.sources, this.compiler.lastCompilationResult.data.sources) return self.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, this.compiler.lastCompilationResult.source.sources, this.compiler.lastCompilationResult.data.sources)
}, (step) => { }, (step) => {
@ -54,10 +47,6 @@ function Debugger (options) {
self.step_manager.jumpTo(step) self.step_manager.jumpTo(step)
}) })
this.addProvider('vm', this.executionContext.vm())
this.addProvider('injected', this.executionContext.internalWeb3())
this.addProvider('web3', this.executionContext.internalWeb3())
this.switchProvider(this.executionContext.getProvider())
} }
Debugger.prototype.addProvider = function (type, obj) { Debugger.prototype.addProvider = function (type, obj) {
@ -104,7 +93,7 @@ Debugger.prototype.registerAndHighlightCodeItem = function (index) {
Debugger.prototype.debug = function (blockNumber, txNumber, tx, loadingCb) { Debugger.prototype.debug = function (blockNumber, txNumber, tx, loadingCb) {
const self = this const self = this
let web3 = this.executionContext.web3() let web3 = this.debugger.web3
if (this.debugger.traceManager.isLoading) { if (this.debugger.traceManager.isLoading) {
return return

Loading…
Cancel
Save