}
}
- private enum ErrorType {
- WARNING,
- ERROR;
-
- public string to_string () {
- switch (this) {
- case ErrorType.WARNING:
- return "warning";
-
- case ErrorType.ERROR:
- return "error";
- }
-
- assert_not_reached ();
- }
- }
-
- private inline void msg (ErrorType type, string file, long line, long startpos, long endpos, string errline, string msg_format, va_list args) {
- this.stream.printf ("%s:%lu.%lu-%lu.%lu: %s: ", file, line, startpos, line, endpos, type.to_string ());
+ private inline void msg (string type, string file, long line, long startpos, long endpos, string errline, string msg_format, va_list args) {
+ this.stream.printf ("%s:%lu.%lu-%lu.%lu: %s: ", file, line, startpos, line, endpos, type);
this.stream.vprintf (msg_format, args);
this.stream.putc ('\n');
public void error (string file, long line, long startpos, long endpos, string errline, string msg_format, ...) {
var args = va_list();
- this.msg (ErrorType.ERROR, file, line, startpos, endpos, errline, msg_format, args);
+ this.msg ("error", file, line, startpos, endpos, errline, msg_format, args);
this._errors++;
}
public void warning (string file, long line, long startpos, long endpos, string errline, string msg_format, ...) {
var args = va_list();
- this.msg (ErrorType.WARNING, file, line, startpos, endpos, errline, msg_format, args);
+ this.msg ("warning", file, line, startpos, endpos, errline, msg_format, args);
this._warnings++;
}
}