Unverified Commit 00629a0b authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #658 from ethereum/retrieveCompilationResult

retrieve compilation result from remix GUI
parents fde4ee1e 570ceff9
...@@ -25,7 +25,11 @@ var css = csjs` ...@@ -25,7 +25,11 @@ var css = csjs`
margin-left: 10px; margin-left: 10px;
} }
` `
function Ethdebugger () {
function Ethdebugger (opts) {
this.opts = opts || {}
if (!this.opts.compilationResult) this.opts.compilationResult = () => { return null }
var self = this var self = this
this.event = new EventManager() this.event = new EventManager()
...@@ -107,6 +111,7 @@ Ethdebugger.prototype.setCompilationResult = function (compilationResult) { ...@@ -107,6 +111,7 @@ Ethdebugger.prototype.setCompilationResult = function (compilationResult) {
} }
Ethdebugger.prototype.debug = function (tx) { Ethdebugger.prototype.debug = function (tx) {
this.setCompilationResult(this.opts.compilationResult())
if (tx instanceof Object) { if (tx instanceof Object) {
this.txBrowser.load(tx.hash) this.txBrowser.load(tx.hash)
} else if (tx instanceof String) { } else if (tx instanceof String) {
...@@ -145,6 +150,7 @@ Ethdebugger.prototype.startDebugging = function (blockNumber, txIndex, tx) { ...@@ -145,6 +150,7 @@ Ethdebugger.prototype.startDebugging = function (blockNumber, txIndex, tx) {
if (this.traceManager.isLoading) { if (this.traceManager.isLoading) {
return return
} }
this.setCompilationResult(this.opts.compilationResult())
this.statusMessage = 'Loading trace...' this.statusMessage = 'Loading trace...'
yo.update(this.view, this.render()) yo.update(this.view, this.render())
console.log('loading trace...') console.log('loading trace...')
......
...@@ -200,7 +200,7 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc ...@@ -200,7 +200,7 @@ function includeVariableDeclaration (tree, step, sourceLocation, scopeId, newLoc
}) })
} }
var functionDefinition = resolveFunctionDefinition(tree, step, previousSourceLocation) var functionDefinition = resolveFunctionDefinition(tree, step, previousSourceLocation)
if (functionDefinition && newLocation && traceHelper.isJumpDestInstruction(tree.traceManager.trace[step - 1])) { if (functionDefinition && ((newLocation && traceHelper.isJumpDestInstruction(tree.traceManager.trace[step - 1])) || functionDefinition.attributes.isConstructor)) {
tree.functionCallStack.push(step) tree.functionCallStack.push(step)
// means: the previous location was a function definition && JUMPDEST // means: the previous location was a function definition && JUMPDEST
// => we are at the beginning of the function and input/output are setup // => we are at the beginning of the function and input/output are setup
......
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