mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-25 18:33:11 +00:00
worker: can return listings with error result
This commit is contained in:
parent
38920c6dce
commit
600e62f0c6
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import { FileData, Dependency, SourceLine, SourceFile, CodeListing, CodeListingMap, WorkerError, Segment, WorkerResult, WorkerOutputResult, isUnchanged, isOutputResult, WorkerMessage, WorkerItemUpdate } from "../common/workertypes";
|
import { FileData, Dependency, SourceLine, SourceFile, CodeListing, CodeListingMap, WorkerError, Segment, WorkerResult, WorkerOutputResult, isUnchanged, isOutputResult, WorkerMessage, WorkerItemUpdate, WorkerErrorResult, isErrorResult } from "../common/workertypes";
|
||||||
import { getFilenamePrefix, getFolderForPath, isProbablyBinary, getBasePlatform, getWithBinary } from "../common/util";
|
import { getFilenamePrefix, getFolderForPath, isProbablyBinary, getBasePlatform, getWithBinary } from "../common/util";
|
||||||
import { Platform } from "../common/baseplatform";
|
import { Platform } from "../common/baseplatform";
|
||||||
import localforage from "localforage";
|
import localforage from "localforage";
|
||||||
@ -129,6 +129,8 @@ export class CodeProject {
|
|||||||
}
|
}
|
||||||
if (data && isOutputResult(data)) {
|
if (data && isOutputResult(data)) {
|
||||||
this.processBuildResult(data);
|
this.processBuildResult(data);
|
||||||
|
} else if (isErrorResult(data)) {
|
||||||
|
this.processBuildListings(data);
|
||||||
}
|
}
|
||||||
this.callbackBuildResult(data);
|
this.callbackBuildResult(data);
|
||||||
}
|
}
|
||||||
@ -376,7 +378,7 @@ export class CodeProject {
|
|||||||
this.sendBuild();
|
this.sendBuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
processBuildResult(data: WorkerOutputResult<any>) {
|
processBuildListings(data: WorkerOutputResult<any> | WorkerErrorResult) {
|
||||||
// TODO: link listings with source files
|
// TODO: link listings with source files
|
||||||
if (data.listings) {
|
if (data.listings) {
|
||||||
this.listings = data.listings;
|
this.listings = data.listings;
|
||||||
@ -388,6 +390,14 @@ export class CodeProject {
|
|||||||
lst.assemblyfile = new SourceFile(lst.asmlines, lst.text);
|
lst.assemblyfile = new SourceFile(lst.asmlines, lst.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processBuildResult(data: WorkerOutputResult<any>) {
|
||||||
|
this.processBuildListings(data);
|
||||||
|
this.processBuildSegments(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
processBuildSegments(data: WorkerOutputResult<any>) {
|
||||||
// save and sort segment list
|
// save and sort segment list
|
||||||
var segs = (this.platform.getMemoryMap && this.platform.getMemoryMap()["main"]) || [];
|
var segs = (this.platform.getMemoryMap && this.platform.getMemoryMap()["main"]) || [];
|
||||||
if (data.segments) { segs = segs.concat(data.segments || []); }
|
if (data.segments) { segs = segs.concat(data.segments || []); }
|
||||||
|
@ -323,7 +323,7 @@ function refreshWindowList() {
|
|||||||
for (var lstfn in listings) {
|
for (var lstfn in listings) {
|
||||||
var lst = listings[lstfn];
|
var lst = listings[lstfn];
|
||||||
// add listing if source/assembly file exists and has text
|
// add listing if source/assembly file exists and has text
|
||||||
if ((lst.assemblyfile && lst.assemblyfile.text) || (lst.sourcefile && lst.sourcefile.text)) {
|
if ((lst.assemblyfile && lst.assemblyfile.text) || (lst.sourcefile && lst.sourcefile.text) || lst.text) {
|
||||||
addWindowItem(lstfn, getFilenameForPath(lstfn), (path) => {
|
addWindowItem(lstfn, getFilenameForPath(lstfn), (path) => {
|
||||||
return new ListingView(path);
|
return new ListingView(path);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user