Second pass on the programmatic asc API; Make compiler tests use asc directly

This commit is contained in:
dcodeIO
2018-02-04 07:51:40 +01:00
parent 349de60129
commit 819d79889d
101 changed files with 5815 additions and 12243 deletions

View File

@ -161,7 +161,7 @@ export function formatDiagnosticContext(range: Range, useColors: bool = false):
export abstract class DiagnosticEmitter {
diagnostics: DiagnosticMessage[];
silentDiagnostics: bool = false;
// silentDiagnostics: bool = false;
constructor(diagnostics: DiagnosticMessage[] | null = null) {
this.diagnostics = diagnostics ? <DiagnosticMessage[]>diagnostics : new Array();
@ -170,10 +170,10 @@ export abstract class DiagnosticEmitter {
emitDiagnostic(code: DiagnosticCode, category: DiagnosticCategory, range: Range, arg0: string | null = null, arg1: string | null = null) {
var message = DiagnosticMessage.create(code, category, arg0, arg1).withRange(range);
this.diagnostics.push(message);
if (!this.silentDiagnostics) {
/* if (!this.silentDiagnostics) {
console.log(formatDiagnosticMessage(message, true, true) + "\n"); // temporary
// console.log(<string>new Error("stack").stack);
}
console.log(<string>new Error("stack").stack);
} */
}
error(code: DiagnosticCode, range: Range, arg0: string | null = null, arg1: string | null = null): void {

View File

@ -138,4 +138,3 @@ export function decompile(module: Module): string {
decompiler.decompile(module);
return decompiler.finish();
}

View File

@ -111,7 +111,7 @@ export class Parser extends DiagnosticEmitter {
this.program.sources.push(source);
var tn = new Tokenizer(source, this.program.diagnostics);
tn.silentDiagnostics = this.silentDiagnostics;
// tn.silentDiagnostics = this.silentDiagnostics;
source.tokenizer = tn;
while (!tn.skip(Token.ENDOFFILE)) {