|
|
@@ -43,9 +43,19 @@ namespace Mono.ILASM {
|
|
|
}
|
|
|
|
|
|
public static void Error (string message)
|
|
|
+ {
|
|
|
+ Error (null, null, message);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Error (Location location, string message)
|
|
|
+ {
|
|
|
+ Error (null, location, message);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void Error (string file_path, Location location, string message)
|
|
|
{
|
|
|
error_count++;
|
|
|
- throw new ILAsmException (message);
|
|
|
+ throw new ILAsmException (file_path, location, message);
|
|
|
}
|
|
|
|
|
|
public static void Message (string message)
|
|
|
@@ -67,23 +77,50 @@ namespace Mono.ILASM {
|
|
|
public class ILAsmException : Exception {
|
|
|
|
|
|
string message;
|
|
|
+ string file_path;
|
|
|
Location location;
|
|
|
|
|
|
- public ILAsmException (Location location, string message)
|
|
|
+ public ILAsmException (string file_path, Location location, string message)
|
|
|
{
|
|
|
+ this.file_path = file_path;
|
|
|
this.location = location;
|
|
|
this.message = message;
|
|
|
}
|
|
|
|
|
|
+ public ILAsmException (Location location, string message)
|
|
|
+ : this (null, location, message)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
public ILAsmException (string message)
|
|
|
+ : this (null, null, message)
|
|
|
{
|
|
|
- this.message = message;
|
|
|
}
|
|
|
|
|
|
public override string Message {
|
|
|
get { return message; }
|
|
|
}
|
|
|
|
|
|
+ public Location Location {
|
|
|
+ get { return location; }
|
|
|
+ set { location = value; }
|
|
|
+ }
|
|
|
+
|
|
|
+ public string FilePath {
|
|
|
+ get { return file_path; }
|
|
|
+ set { file_path = value; }
|
|
|
+ }
|
|
|
+
|
|
|
+ public override string ToString ()
|
|
|
+ {
|
|
|
+ string location_str = "";
|
|
|
+ if (location != null)
|
|
|
+ location_str = " (" + location.line + ", " + location.column + ") : ";
|
|
|
+
|
|
|
+ return String.Format ("{0}{1}Error : {2}",
|
|
|
+ (file_path != null ? file_path : ""), location_str, message);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public class InternalErrorException : Exception {
|