Commit ed4c94cd authored by yann300's avatar yann300

readd format assembly text

parent e7f05126
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"browserify": "^13.0.0", "browserify": "^13.0.0",
"csslint": "^1.0.2", "csslint": "^1.0.2",
"es6-shim": "^0.35.1", "es6-shim": "^0.35.1",
"ethereum-remix": "0.0.2-alpha.0.0.7", "ethereum-remix": "0.0.2-alpha.0.0.8",
"ethereumjs-abi": "^0.6.4", "ethereumjs-abi": "^0.6.4",
"ethereumjs-block": "^1.2.2", "ethereumjs-block": "^1.2.2",
"ethereumjs-tx": "^1.1.1", "ethereumjs-tx": "^1.1.1",
......
...@@ -109,9 +109,6 @@ var run = function () { ...@@ -109,9 +109,6 @@ var run = function () {
el.parent().find('li').removeClass('active'); el.parent().find('li').removeClass('active');
$('#optionViews').attr('class', '').addClass(cls); $('#optionViews').attr('class', '').addClass(cls);
el.addClass('active'); el.addClass('active');
} else {
el.removeClass('active');
$('#optionViews').removeClass(cls);
} }
self.event.trigger('tabChanged', [cls]); self.event.trigger('tabChanged', [cls]);
}; };
...@@ -424,7 +421,7 @@ var run = function () { ...@@ -424,7 +421,7 @@ var run = function () {
var transactionDebugger = new Debugger('#debugger', editor, compiler, executionContext.event, swicthToFile); var transactionDebugger = new Debugger('#debugger', editor, compiler, executionContext.event, swicthToFile);
transactionDebugger.addProvider('vm', executionContext.vm()); transactionDebugger.addProvider('vm', executionContext.vm());
transactionDebugger.switchProvider('VM'); transactionDebugger.switchProvider('vm');
transactionDebugger.addProvider('injected', executionContext.web3()); transactionDebugger.addProvider('injected', executionContext.web3());
transactionDebugger.addProvider('web3', executionContext.web3()); transactionDebugger.addProvider('web3', executionContext.web3());
......
...@@ -16,7 +16,7 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) { ...@@ -16,7 +16,7 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
var compileJSON; var compileJSON;
var compilerAcceptsMultipleFiles; var compilerAcceptsMultipleFiles;
var previousInput = ''; var previousInput = '';
var cachedRemoteFiles = {}; var cachedRemoteFiles = {};
...@@ -60,7 +60,7 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) { ...@@ -60,7 +60,7 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
}); });
}; };
this.compile = compile; this.compile = compile;
function setCompileJSON (_compileJSON) { function setCompileJSON (_compileJSON) {
compileJSON = _compileJSON; compileJSON = _compileJSON;
} }
...@@ -101,18 +101,16 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) { ...@@ -101,18 +101,16 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
this.lastCompilationResult = { this.lastCompilationResult = {
data: null, data: null,
source: null source: null
} };
function compilationFinished (data, missingInputs, source) { function compilationFinished (data, missingInputs, source) {
var noFatalErrors = true; // ie warnings are ok var noFatalErrors = true; // ie warnings are ok
if (data['error'] !== undefined) { if (data['error'] !== undefined) {
self.event.trigger('compilationFinished', [false, [data['error']], source]);
if (utils.errortype(data['error']) !== 'warning') { if (utils.errortype(data['error']) !== 'warning') {
noFatalErrors = false; noFatalErrors = false;
} }
} }
if (data['errors'] !== undefined) { if (data['errors'] !== undefined) {
self.event.trigger('compilationFinished', [false, data['errors'], source]);
data['errors'].forEach(function (err) { data['errors'].forEach(function (err) {
if (utils.errortype(err) !== 'warning') { if (utils.errortype(err) !== 'warning') {
noFatalErrors = false; noFatalErrors = false;
...@@ -120,13 +118,15 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) { ...@@ -120,13 +118,15 @@ function Compiler (editor, queryParams, handleGithubCall, updateFiles) {
}); });
} }
if (missingInputs !== undefined && missingInputs.length > 0) { if (!noFatalErrors) {
self.event.trigger('compilationFinished', [false, data, source]);
} else if (missingInputs !== undefined && missingInputs.length > 0) {
compile(missingInputs); compile(missingInputs);
} else if (noFatalErrors) { } else {
self.lastCompilationResult = { self.lastCompilationResult = {
data: data, data: data,
source: source source: source
} };
self.event.trigger('compilationFinished', [true, data, source]); self.event.trigger('compilationFinished', [true, data, source]);
} }
} }
......
...@@ -9,12 +9,12 @@ var Range = ace.acequire('ace/range').Range; ...@@ -9,12 +9,12 @@ var Range = ace.acequire('ace/range').Range;
function Debugger (id, editor, compiler, executionContextEvent, switchToFile) { function Debugger (id, editor, compiler, executionContextEvent, switchToFile) {
this.el = document.querySelector(id); this.el = document.querySelector(id);
this.debugger = new remix.ui.Debugger(); this.debugger = new remix.ui.Debugger();
this.sourceMappingDecoder = new remix.util.SourceMappingDecoder() this.sourceMappingDecoder = new remix.util.SourceMappingDecoder();
this.el.appendChild(this.debugger.render()); this.el.appendChild(this.debugger.render());
this.editor = editor; this.editor = editor;
this.switchToFile = switchToFile; this.switchToFile = switchToFile;
this.compiler = compiler; this.compiler = compiler;
this.cache = new Cache() this.cache = new Cache();
var self = this; var self = this;
executionContextEvent.register('contextChanged', this, function (context) { executionContextEvent.register('contextChanged', this, function (context) {
...@@ -23,33 +23,36 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile) { ...@@ -23,33 +23,36 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile) {
this.lastCompilationResult = null; this.lastCompilationResult = null;
this.debugger.register('newTraceLoaded', this, function () { this.debugger.register('newTraceLoaded', this, function () {
self.cache.clear() self.cache.clear();
self.lastCompilationResult = self.compiler.lastCompilationResult; self.lastCompilationResult = self.compiler.lastCompilationResult;
}); });
this.debugger.register('traceUnloaded', this, function () { this.debugger.register('traceUnloaded', this, function () {
self.lastCompilationResult = null; self.removeCurrentMarker();
self.removeCurrentMarker() self.cache.clear();
self.cache.clear()
}); });
this.editor.onChangeSetup(function () { this.editor.onChangeSetup(function () {
if (arguments.length > 0) { // if arguments.length === 0 this is a session change, we don't want to stop debugging in that case if (arguments.length > 0) { // if arguments.length === 0 this is a session change, we don't want to stop debugging in that case
self.debugger.unLoad() self.debugger.unLoad();
} }
}); });
// register selected code item, highlight the corresponding source location // register selected code item, highlight the corresponding source location
this.debugger.codeManager.register('changed', this, function (code, address, index) { this.debugger.codeManager.register('changed', this, function (code, address, index) {
this.debugger.sourceLocationTracker.getSourceLocation(address, index, self.lastCompilationResult.data.contracts, function (error, rawLocation) { if (self.lastCompilationResult) {
if (!error) { this.debugger.sourceLocationTracker.getSourceLocation(address, index, self.lastCompilationResult.data.contracts, function (error, rawLocation) {
if (!self.cache.lineBreakPositionsByContent[address]) { if (!error) {
self.cache.lineBreakPositionsByContent[address] = self.sourceMappingDecoder.getLinebreakPositions(self.editor.getFile(self.lastCompilationResult.data.sourceList[rawLocation.file])) if (!self.cache.lineBreakPositionsByContent[address]) {
self.cache.lineBreakPositionsByContent[address] = self.sourceMappingDecoder.getLinebreakPositions(self.editor.getFile(self.lastCompilationResult.data.sourceList[rawLocation.file]));
}
var lineColumnPos = self.sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, self.cache.lineBreakPositionsByContent[address]);
self.highlight(lineColumnPos, rawLocation);
} else {
self.removeCurrentMarker();
} }
var lineColumnPos = self.sourceMappingDecoder.convertOffsetToLineColumn(rawLocation, self.cache.lineBreakPositionsByContent[address]) });
self.highlight(lineColumnPos, rawLocation); }
}
});
}); });
} }
...@@ -120,13 +123,12 @@ Debugger.prototype.removeCurrentMarker = function () { ...@@ -120,13 +123,12 @@ Debugger.prototype.removeCurrentMarker = function () {
} }
}; };
function Cache () { function Cache () {
this.contentLineBreakPosition = {} this.contentLineBreakPosition = {};
} }
Cache.prototype.clear = function () { Cache.prototype.clear = function () {
this.lineBreakPositionsByContent = {} this.lineBreakPositionsByContent = {};
} };
module.exports = Debugger; module.exports = Debugger;
...@@ -16,12 +16,12 @@ function Editor (loadingFromGist, storage) { ...@@ -16,12 +16,12 @@ function Editor (loadingFromGist, storage) {
setupStuff(getFiles()); setupStuff(getFiles());
this.addMarker = function (range, cssClass) { this.addMarker = function (range, cssClass) {
return editor.session.addMarker(range, cssClass) return editor.session.addMarker(range, cssClass);
} };
this.removeMarker = function (markerId) { this.removeMarker = function (markerId) {
editor.session.removeMarker(markerId) editor.session.removeMarker(markerId);
} };
this.newFile = function () { this.newFile = function () {
var untitledCount = ''; var untitledCount = '';
......
...@@ -45,7 +45,7 @@ function ExecutionContext () { ...@@ -45,7 +45,7 @@ function ExecutionContext () {
this.setContext = function (context) { this.setContext = function (context) {
executionContext = context; executionContext = context;
executionContextChange(context); executionContextChange(context);
setExecutionContextRadio() setExecutionContextRadio();
}; };
var $injectedToggle = $('#injected-mode'); var $injectedToggle = $('#injected-mode');
......
...@@ -20,9 +20,14 @@ function Renderer (editor, web3, updateFiles, udapp, executionContext, formalVer ...@@ -20,9 +20,14 @@ function Renderer (editor, web3, updateFiles, udapp, executionContext, formalVer
if (success) { if (success) {
self.contracts(data, source); self.contracts(data, source);
} else { } else {
data.forEach(function (err) { if (data['error']) {
self.error(err); self.error(data['error']);
}); }
if (data['errors']) {
data['errors'].forEach(function (err) {
self.error(err);
});
}
} }
}); });
} }
...@@ -93,11 +98,17 @@ Renderer.prototype.contracts = function (data, source) { ...@@ -93,11 +98,17 @@ Renderer.prototype.contracts = function (data, source) {
$contractOutput.append(uiHelper.textRow('Web3 deploy', uiHelper.gethDeploy(contractName.toLowerCase(), contract['interface'], contract.bytecode), 'deploy')); $contractOutput.append(uiHelper.textRow('Web3 deploy', uiHelper.gethDeploy(contractName.toLowerCase(), contract['interface'], contract.bytecode), 'deploy'));
$contractOutput.append(uiHelper.textRow('uDApp', combined(contractName, contract['interface'], contract.bytecode), 'deploy')); $contractOutput.append(uiHelper.textRow('uDApp', combined(contractName, contract['interface'], contract.bytecode), 'deploy'));
} }
return $contractOutput.append(uiHelper.getDetails(contract, source, contractName)); var ctrSource = getSource(contractName, source, data);
return $contractOutput.append(uiHelper.getDetails(contract, ctrSource, contractName));
}; };
// // // //
var self = this; var self = this;
var getSource = function (contractName, source, data) {
var currentFile = utils.fileNameFromKey(self.editor.getCacheFile());
return source.sources[currentFile];
};
var getAddress = function () { return $('#txorigin').val(); }; var getAddress = function () { return $('#txorigin').val(); };
var getValue = function () { var getValue = function () {
......
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