mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-22 14:33:51 +00:00
clear error markers when build, error, unchanged; hack for dumpMemory() to work
This commit is contained in:
parent
9b41ae022a
commit
d146a7adee
@ -83,6 +83,9 @@ div.mem_info {
|
||||
z-index: 12;
|
||||
font-family: "Andale Mono", "Menlo", "Lucida Console", monospace;
|
||||
font-size: 12pt;
|
||||
-webkit-box-shadow: 3px 3px 5px rgba(0,0,0,.5);
|
||||
-moz-box-shadow: 3px 3px 5px rgba(0,0,0,.5);
|
||||
box-shadow: 3px 3px 5px rgba(0,0,0,.5);
|
||||
}
|
||||
.btn_group {
|
||||
border-radius:6px;
|
||||
|
@ -162,7 +162,7 @@ function CodeProject(worker, platform_id, platform, store) {
|
||||
self.callbackBuildStatus(false);
|
||||
if (e.data && !e.data.unchanged) {
|
||||
processBuildResult(e.data);
|
||||
self.callbackBuildResult(e.data);
|
||||
self.callbackBuildResult(e.data); // call with data when changed
|
||||
}
|
||||
};
|
||||
|
||||
|
33
src/ui.js
33
src/ui.js
@ -120,6 +120,8 @@ function initProject() {
|
||||
toolbar.addClass("is-busy");
|
||||
} else {
|
||||
toolbar.removeClass("is-busy");
|
||||
toolbar.removeClass("has-errors"); // may be added in next callback
|
||||
getActiveEditor().clearErrors(); // TODO: add current line marker
|
||||
}
|
||||
$('#compile_spinner').css('visibility', busy ? 'visible' : 'hidden');
|
||||
};
|
||||
@ -202,8 +204,8 @@ function SourceEditor(path) {
|
||||
|
||||
self.markErrors = function(errors) {
|
||||
// TODO: move cursor to error line if offscreen?
|
||||
self.clearErrors();
|
||||
toolbar.addClass("has-errors");
|
||||
editor.clearGutter("gutter-info");
|
||||
var numLines = editor.lineCount();
|
||||
for (var info of errors) {
|
||||
var line = info.line-1;
|
||||
@ -212,6 +214,10 @@ function SourceEditor(path) {
|
||||
}
|
||||
}
|
||||
|
||||
self.clearErrors = function() {
|
||||
editor.clearGutter("gutter-info");
|
||||
}
|
||||
|
||||
self.updateListing = function(sourcefile) {
|
||||
// update editor annotations
|
||||
// TODO: do incrementally for performance
|
||||
@ -460,7 +466,7 @@ function getCurrentFilename() {
|
||||
}
|
||||
|
||||
function _shareFile(e) {
|
||||
if (current_output == null) {
|
||||
if (current_output == null) { // TODO
|
||||
alert("Please fix errors before sharing.");
|
||||
return true;
|
||||
}
|
||||
@ -493,7 +499,7 @@ function _resetPreset(e) {
|
||||
}
|
||||
|
||||
function _downloadROMImage(e) {
|
||||
if (current_output == null) {
|
||||
if (current_output == null) { // TODO
|
||||
alert("Please fix errors before downloading ROM.");
|
||||
return true;
|
||||
}
|
||||
@ -560,8 +566,11 @@ function setCode(text) {
|
||||
}
|
||||
|
||||
function setCompileOutput(data) {
|
||||
// TODO: kills current selection
|
||||
// TODO: use current_project
|
||||
var sed = getActiveEditor();
|
||||
// errors?
|
||||
if (data.errors && data.errors.length > 0) {
|
||||
sed.markErrors(data.errors);
|
||||
} else {
|
||||
// choose first listing (TODO:support multiple source files)
|
||||
sourcefile = null;
|
||||
assemblyfile = null;
|
||||
@ -579,14 +588,9 @@ function setCompileOutput(data) {
|
||||
if (!sourcefile) sourcefile = new SourceFile();
|
||||
symbolmap = data.symbolmap;
|
||||
addr2symbol = invertMap(symbolmap);
|
||||
addr2symbol[0x10000] = '__END__'; // TODO?
|
||||
if (!addr2symbol[0x0]) addr2symbol[0x0] = '__START__'; // needed for ...
|
||||
addr2symbol[0x10000] = '__END__'; // needed for dump memory to work
|
||||
compparams = data.params;
|
||||
var sed = getActiveEditor();
|
||||
// errors?
|
||||
if (data.errors && data.errors.length > 0) {
|
||||
sed.markErrors(data.errors);
|
||||
current_output = null;
|
||||
} else {
|
||||
// load ROM
|
||||
// TODO: don't have to compare anymore; worker does it
|
||||
var rom = data.output;
|
||||
@ -602,7 +606,6 @@ function setCompileOutput(data) {
|
||||
if (!userPaused) resume();
|
||||
current_output = rom;
|
||||
//resetProfiler();
|
||||
toolbar.removeClass("has-errors");
|
||||
} catch (e) {
|
||||
console.log(e); // TODO: show error
|
||||
toolbar.addClass("has-errors");
|
||||
@ -794,8 +797,8 @@ function updateDisassembly() {
|
||||
}
|
||||
}
|
||||
}
|
||||
// fall through to platform disassembler?
|
||||
if (platform.disassemble) {
|
||||
// TODO: fall through to platform disassembler?
|
||||
else if (platform.disassemble) {
|
||||
var curline = 0;
|
||||
var selline = 0;
|
||||
// TODO: not perfect disassembler
|
||||
|
@ -212,5 +212,6 @@ describe('Worker', function() {
|
||||
var msgs = [m, m, m2];
|
||||
doBuild(msgs, done, 8192, [1,1], 0);
|
||||
});
|
||||
// TODO: test if compile, errors, then compile same file
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user