Commit 8f6ad3f4 authored by yann300's avatar yann300

use filename instead of index

parent 2e4e965f
......@@ -113,8 +113,9 @@ class BreakpointManager {
* @return {Bool} return true if the given @arg fileIndex @arg line refers to a breakpoint
*/
hasBreakpointAtLine (fileIndex, line) {
if (this.breakpoints[fileIndex]) {
var sources = this.breakpoints[fileIndex]
var filename = this.debugger.solidityProxy.fileNameFromIndex(fileIndex)
if (filename && this.breakpoints[filename]) {
var sources = this.breakpoints[filename]
for (var k in sources) {
var source = sources[k]
if (line === source.row) {
......@@ -145,10 +146,10 @@ class BreakpointManager {
* @param {Object} sourceLocation - position of the breakpoint { file: '<file index>', row: '<line number' }
*/
add (sourceLocation) {
if (!this.breakpoints[sourceLocation.file]) {
this.breakpoints[sourceLocation.file] = []
if (!this.breakpoints[sourceLocation.fileName]) {
this.breakpoints[sourceLocation.fileName] = []
}
this.breakpoints[sourceLocation.file].push(sourceLocation)
this.breakpoints[sourceLocation.fileName].push(sourceLocation)
this.event.trigger('breakpointAdded', [sourceLocation])
}
......@@ -158,8 +159,8 @@ class BreakpointManager {
* @param {Object} sourceLocation - position of the breakpoint { file: '<file index>', row: '<line number' }
*/
remove (sourceLocation) {
if (this.breakpoints[sourceLocation.file]) {
var sources = this.breakpoints[sourceLocation.file]
if (this.breakpoints[sourceLocation.fileName]) {
var sources = this.breakpoints[sourceLocation.fileName]
for (var k in sources) {
var source = sources[k]
if (sourceLocation.row === source.row) {
......
......@@ -120,6 +120,16 @@ class SolidityProxy {
return null
}
}
/**
* get the filename refering to the index from the compilation result
*
* @param {Int} index - index of the filename
* @return {String} - filename
*/
fileNameFromIndex (index) {
return this.sourceList[index]
}
}
function contractNameFromCode (contracts, code, address) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment