Commit d9519965 authored by yann300's avatar yann300

rename handleErrorClick / use API

parent f67c4886
...@@ -149,9 +149,9 @@ function Editor (doNotLoadStorage, storage) { ...@@ -149,9 +149,9 @@ function Editor (doNotLoadStorage, storage) {
editor.getSession().setAnnotations(sourceAnnotations) editor.getSession().setAnnotations(sourceAnnotations)
} }
this.handleErrorClick = function (errLine, errCol) { this.gotoLine = function (line, col) {
editor.focus() editor.focus()
editor.gotoLine(errLine + 1, errCol - 1, true) editor.gotoLine(line + 1, col - 1, true)
} }
function newEditorSession (filekey) { function newEditorSession (filekey) {
......
...@@ -4,11 +4,10 @@ var $ = require('jquery') ...@@ -4,11 +4,10 @@ var $ = require('jquery')
var utils = require('./utils') var utils = require('./utils')
function Renderer (editor, updateFiles, udapp, executionContext, formalVerificationEvent, compilerEvent) { function Renderer (editorAPI, udappAPI, ethToolAPI, formalVerificationEvent, compilerEvent) {
this.editor = editor this.editorAPI = editorAPI
this.updateFiles = updateFiles this.udappAPI = udappAPI
this.udapp = udapp this.ethToolAPI = ethToolAPI
this.executionContext = executionContext
var self = this var self = this
formalVerificationEvent.register('compilationFinished', this, function (success, message, container, options) { formalVerificationEvent.register('compilationFinished', this, function (success, message, container, options) {
if (!success) { if (!success) {
...@@ -55,8 +54,8 @@ Renderer.prototype.error = function (message, container, options) { ...@@ -55,8 +54,8 @@ Renderer.prototype.error = function (message, container, options) {
var errFile = err[1] var errFile = err[1]
var errLine = parseInt(err[2], 10) - 1 var errLine = parseInt(err[2], 10) - 1
var errCol = err[4] ? parseInt(err[4], 10) : 0 var errCol = err[4] ? parseInt(err[4], 10) : 0
if (!opt.noAnnotations && (errFile === '' || errFile === self.editor.getCacheFile())) { if (!opt.noAnnotations && (errFile === '' || errFile === self.editorAPI.currentOpenedFile())) {
self.editor.addAnnotation({ self.editorAPI.addAnnotation({
row: errLine, row: errLine,
column: errCol, column: errCol,
text: message, text: message,
...@@ -64,12 +63,11 @@ Renderer.prototype.error = function (message, container, options) { ...@@ -64,12 +63,11 @@ Renderer.prototype.error = function (message, container, options) {
}) })
} }
$error.click(function (ev) { $error.click(function (ev) {
if (errFile !== '' && errFile !== self.editor.getCacheFile() && self.editor.hasFile(errFile)) { if (errFile !== '' && errFile !== self.editorAPI.currentOpenedFile() && self.editorAPI.hasFile(errFile)) {
// Switch to file // Switch to file
self.editor.setCacheFile(errFile) self.editorAPI.switchToFile(errFile)
self.updateFiles()
} }
self.editor.handleErrorClick(errLine, errCol) self.editorAPI.gotoLine(errLine, errCol)
}) })
} }
$error.find('.close').click(function (ev) { $error.find('.close').click(function (ev) {
...@@ -288,7 +286,7 @@ Renderer.prototype.contracts = function (data, source) { ...@@ -288,7 +286,7 @@ Renderer.prototype.contracts = function (data, source) {
var self = this var self = this
var getSource = function (contractName, source, data) { var getSource = function (contractName, source, data) {
var currentFile = self.editor.getCacheFile() var currentFile = self.editorAPI.currentOpenedFile()
return source.sources[currentFile] return source.sources[currentFile]
} }
...@@ -299,7 +297,7 @@ Renderer.prototype.contracts = function (data, source) { ...@@ -299,7 +297,7 @@ Renderer.prototype.contracts = function (data, source) {
var getValue = function (cb) { var getValue = function (cb) {
try { try {
var comp = $('#value').val().split(' ') var comp = $('#value').val().split(' ')
cb(null, self.executionContext.web3().toWei(comp[0], comp.slice(1).join(' '))) cb(null, self.ethToolAPI.toWei(comp[0], comp.slice(1).join(' ')))
} catch (e) { } catch (e) {
cb(e) cb(e)
} }
...@@ -309,13 +307,13 @@ Renderer.prototype.contracts = function (data, source) { ...@@ -309,13 +307,13 @@ Renderer.prototype.contracts = function (data, source) {
cb(null, $('#gasLimit').val()) cb(null, $('#gasLimit').val())
} }
this.udapp.reset(udappContracts, getAddress, getValue, getGasLimit, renderOutputModifier) this.udappAPI.reset(udappContracts, getAddress, getValue, getGasLimit, renderOutputModifier)
var $contractOutput = this.udapp.render() var $contractOutput = this.udappAPI.render()
var $txOrigin = $('#txorigin') var $txOrigin = $('#txorigin')
this.udapp.getAccounts(function (err, accounts) { this.udappAPI.getAccounts(function (err, accounts) {
if (err) { if (err) {
self.error(err.message) self.error(err.message)
} }
......
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