mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 06:21:29 +00:00
Second pass on the programmatic asc API; Make compiler tests use asc directly
This commit is contained in:
@ -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 {
|
||||
|
@ -138,4 +138,3 @@ export function decompile(module: Module): string {
|
||||
decompiler.decompile(module);
|
||||
return decompiler.finish();
|
||||
}
|
||||
|
||||
|
@ -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)) {
|
||||
|
Reference in New Issue
Block a user