use new API

pull/1/head
yann300 8 years ago
parent 3b7d4dd5de
commit 053304ef7c
  1. 4
      assets/css/browser-solidity.css
  2. 21
      src/app/debugger.js
  3. 4
      src/app/editor.js

@ -487,3 +487,7 @@ input[type="file"] {
background-color:#F4B9B7;
opacity: 0.5;
}
.ace_gutter-cell.ace_breakpoint{
background-color: #F77E79;
}

@ -11,28 +11,28 @@ function Debugger (id, appAPI, executionContextEvent, editorEvent) {
this.sourceMappingDecoder = new remix.util.SourceMappingDecoder()
this.el.appendChild(this.debugger.render())
this.appAPI = appAPI
this.markers = {}
this.breakPointManager = new remix.code.BreakpointManager(this.debugger, (sourceLocation) => {
return this.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, this.editor, this.compiler.lastCompilationResult.data)
return appAPI.offsetToLineColumn(sourceLocation, sourceLocation.file, this.editor, this.appAPI.lastCompilationResult().data)
})
this.debugger.setBreakpointManager(this.breakPointManager)
this.breakPointManager.event.register('breakpointHit', (sourceLocation) => {
})
var self = this
editorEvent.register('breakpointCleared', (fileName, row) => {
if (self.compiler.lastCompilationResult.data) {
if (self.appAPI.lastCompilationResult().data) {
this.breakPointManager.remove({fileName: fileName, row: row})
}
})
editorEvent.register('breakpointAdded', (fileName, row) => {
if (self.compiler.lastCompilationResult.data) {
if (self.appAPI.lastCompilationResult().data) {
this.breakPointManager.add({fileName: fileName, row: row})
}
})
var self = this
executionContextEvent.register('contextChanged', this, function (context) {
self.switchProvider(context)
})
@ -44,7 +44,6 @@ function Debugger (id, appAPI, executionContextEvent, editorEvent) {
// unload if a file has changed (but not if tabs were switched)
editorEvent.register('contentChanged', function () {
self.debugger.unLoad()
self.removeMarkers()
})
// register selected code item, highlight the corresponding source location
@ -77,16 +76,6 @@ Debugger.prototype.debug = function (txHash) {
})
}
Debugger.prototype.switchFile = function (rawLocation) {
var name = this.editor.getCacheFile() // current opened tab
if (this.compiler.lastCompilationResult.data) {
var source = this.compiler.lastCompilationResult.data.sourceList[rawLocation.file] // auto switch to that tab
if (name !== source) {
this.switchToFile(source) // command the app to swicth to the next file
}
}
}
/**
* add a new web3 provider to remix
*

@ -28,14 +28,14 @@ function Editor () {
var breakpoints = e.editor.session.getBreakpoints()
for (var k in breakpoints) {
if (k === row.toString()) {
event.trigger('breakpointCleared', [self.getCacheFile(), row])
event.trigger('breakpointCleared', [currentSession, row])
e.editor.session.clearBreakpoint(row)
e.stop()
return
}
}
self.setBreakpoint(row)
event.trigger('breakpointAdded', [self.getCacheFile(), row])
event.trigger('breakpointAdded', [currentSession, row])
e.stop()
})

Loading…
Cancel
Save