Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs/ilasm
diff options
context:
space:
mode:
authorAnkit Jain <radical@corewars.org>2006-06-07 14:10:39 +0400
committerAnkit Jain <radical@corewars.org>2006-06-07 14:10:39 +0400
commit2df0023352dacdd8f578b5a54e7f2ad1fd80d04a (patch)
tree960d34bd1e6b4db31821de7d504e97547b491811 /mcs/ilasm
parenteb91d44a17050ea1bed448a6ce655e3c03a09e66 (diff)
In ilasm/codegen:
* TypeDef.cs (TypeDef.AddFieldDef): (TypeDef.Define): Use Report.Warning instead of Console.Error.WriteLine (TypeDef.AddMethodDef): Likewise. Also, use methoddef.Location . * ExternTable.cs (ExternTable.GetTypeRef): Likewise. * MethodDef.cs (MethodDef.StartLocation): New. In ilasm: * Report.cs (Report.FilePath): New, static property. (Report.Error): Remove overload with file_path param. (Report.Warning): New. * Driver.cs (DriverMain.Run): Set Report.FilePath . (DriverMain.ProcessFile): Update use of Report.Error . In ilasm/parser: * ILParser.jay : Update to use Report.Warning instead of Console.Error.WriteLine svn path=/trunk/mcs/; revision=61521
Diffstat (limited to 'mcs/ilasm')
-rw-r--r--mcs/ilasm/ChangeLog9
-rw-r--r--mcs/ilasm/Driver.cs8
-rw-r--r--mcs/ilasm/Report.cs29
-rw-r--r--mcs/ilasm/codegen/ChangeLog8
-rw-r--r--mcs/ilasm/codegen/ExternTable.cs4
-rw-r--r--mcs/ilasm/codegen/MethodDef.cs6
-rw-r--r--mcs/ilasm/codegen/TypeDef.cs13
-rw-r--r--mcs/ilasm/parser/ChangeLog5
-rw-r--r--mcs/ilasm/parser/ILParser.jay4
9 files changed, 68 insertions, 18 deletions
diff --git a/mcs/ilasm/ChangeLog b/mcs/ilasm/ChangeLog
index 5e7c15a5221..cc71dc8c246 100644
--- a/mcs/ilasm/ChangeLog
+++ b/mcs/ilasm/ChangeLog
@@ -1,3 +1,12 @@
+2006-06-07 Ankit Jain <jankit@novell.com>
+
+ * Report.cs (Report.FilePath): New, static property.
+ (Report.Error): Remove overload with file_path param.
+ (Report.Warning): New.
+ * Driver.cs (DriverMain.Run): Set Report.FilePath .
+ (DriverMain.ProcessFile): Update use of Report.Error .
+
+
2006-05-26 Ankit Jain <jankit@novell.com>
* ilasm.exe.sources: Add Assembly.cs
diff --git a/mcs/ilasm/Driver.cs b/mcs/ilasm/Driver.cs
index d57ba98fe11..eb5ee04410a 100644
--- a/mcs/ilasm/Driver.cs
+++ b/mcs/ilasm/Driver.cs
@@ -68,8 +68,10 @@ namespace Mono.ILASM {
output_file = CreateOutputFilename ();
try {
codegen = new CodeGen (output_file, target == Target.Dll, debugging_info);
- foreach (string file_path in il_file_list)
+ foreach (string file_path in il_file_list) {
+ Report.FilePath = file_path;
ProcessFile (file_path);
+ }
if (scan_only)
return true;
@@ -180,9 +182,9 @@ namespace Mono.ILASM {
else
parser.yyparse (new ScannerAdapter (scanner), null);
} catch (ILTokenizingException ilte) {
- Report.Error (file_path, ilte.Location, "syntax error at token '" + ilte.Token + "'");
+ Report.Error (ilte.Location, "syntax error at token '" + ilte.Token + "'");
} catch (Mono.ILASM.yyParser.yyException ye) {
- Report.Error (file_path, scanner.Reader.Location, ye.Message);
+ Report.Error (scanner.Reader.Location, ye.Message);
} catch (ILAsmException ie) {
ie.FilePath = file_path;
ie.Location = scanner.Reader.Location;
diff --git a/mcs/ilasm/Report.cs b/mcs/ilasm/Report.cs
index 1a9bce5976b..dd2afd2ee27 100644
--- a/mcs/ilasm/Report.cs
+++ b/mcs/ilasm/Report.cs
@@ -18,6 +18,8 @@ namespace Mono.ILASM {
private static int error_count;
private static int mark_count;
private static bool quiet;
+ /* Current file being processed */
+ private static string file_path;
static Report ()
{
@@ -34,6 +36,11 @@ namespace Mono.ILASM {
set { quiet = value; }
}
+ public static string FilePath {
+ get { return file_path; }
+ set { file_path = value; }
+ }
+
public static void AssembleFile (string file, string listing,
string target, string output)
{
@@ -44,18 +51,28 @@ namespace Mono.ILASM {
public static void Error (string message)
{
- Error (null, null, message);
+ Error (null, message);
}
public static void Error (Location location, string message)
{
- Error (null, location, message);
+ error_count++;
+ throw new ILAsmException (file_path, location, message);
}
- public static void Error (string file_path, Location location, string message)
+ public static void Warning (string message)
{
- error_count++;
- throw new ILAsmException (file_path, location, message);
+ Warning (null, message);
+ }
+
+ public static void Warning (Location location, string message)
+ {
+ string location_str = " : ";
+ if (location != null)
+ location_str = " (" + location.line + ", " + location.column + ") : ";
+
+ Console.Error.WriteLine (String.Format ("{0}{1}Warning -- {2}",
+ (file_path != null ? file_path : ""), location_str, message));
}
public static void Message (string message)
@@ -113,7 +130,7 @@ namespace Mono.ILASM {
public override string ToString ()
{
- string location_str = "";
+ string location_str = " : ";
if (location != null)
location_str = " (" + location.line + ", " + location.column + ") : ";
diff --git a/mcs/ilasm/codegen/ChangeLog b/mcs/ilasm/codegen/ChangeLog
index 52fe0ab71ba..4fa5fc7bca9 100644
--- a/mcs/ilasm/codegen/ChangeLog
+++ b/mcs/ilasm/codegen/ChangeLog
@@ -1,3 +1,11 @@
+2006-06-07 Ankit Jain <jankit@novell.com>
+
+ * TypeDef.cs (TypeDef.AddFieldDef):
+ (TypeDef.Define): Use Report.Warning instead of Console.Error.WriteLine
+ (TypeDef.AddMethodDef): Likewise. Also, use methoddef.Location .
+ * ExternTable.cs (ExternTable.GetTypeRef): Likewise.
+ * MethodDef.cs (MethodDef.StartLocation): New.
+
2006-06-01 Ankit Jain <jankit@novell.com>
* MethodDef.cs (GetNamedParamPos): Return -1 if param_list is null.
diff --git a/mcs/ilasm/codegen/ExternTable.cs b/mcs/ilasm/codegen/ExternTable.cs
index 69cb3c0eaa9..037ecfada85 100644
--- a/mcs/ilasm/codegen/ExternTable.cs
+++ b/mcs/ilasm/codegen/ExternTable.cs
@@ -323,7 +323,7 @@ namespace Mono.ILASM {
if (assembly_table == null && (asmb_name == "mscorlib" || asmb_name == "corlib")) {
/* AddCorlib if mscorlib is being referenced but
we haven't encountered a ".assembly 'name'" as yet. */
- Console.Error.WriteLine ("Warning -- Reference to undeclared extern assembly '{0}', adding.", asmb_name);
+ Report.Warning (String.Format ("Reference to undeclared extern assembly '{0}', adding.", asmb_name));
AddCorlib ();
}
if (assembly_table != null)
@@ -333,7 +333,7 @@ namespace Mono.ILASM {
System.Reflection.AssemblyName asmname = new System.Reflection.AssemblyName ();
asmname.Name = asmb_name;
- Console.Error.WriteLine ("Warning -- Reference to undeclared extern assembly '{0}', adding.", asmb_name);
+ Report.Warning (String.Format ("Reference to undeclared extern assembly '{0}', adding.", asmb_name));
ext_asmb = AddAssembly (asmb_name, asmname);
}
diff --git a/mcs/ilasm/codegen/MethodDef.cs b/mcs/ilasm/codegen/MethodDef.cs
index 8f758df8a77..fc4714beb1c 100644
--- a/mcs/ilasm/codegen/MethodDef.cs
+++ b/mcs/ilasm/codegen/MethodDef.cs
@@ -47,6 +47,7 @@ namespace Mono.ILASM {
private SourceMethod source;
private TypeDef type_def;
private GenericParameters gen_params;
+ private Location start;
public MethodDef (CodeGen codegen, PEAPI.MethAttr meth_attr,
PEAPI.CallConv call_conv, PEAPI.ImplAttr impl_attr,
@@ -61,6 +62,7 @@ namespace Mono.ILASM {
this.type_def = type_def;
this.gen_params = gen_params;
this.ret_param = new ParamDef (PEAPI.ParamAttr.Default, "", ret_type);
+ this.start = (Location) start.Clone ();
inst_list = new ArrayList ();
label_table = new Hashtable ();
@@ -127,6 +129,10 @@ namespace Mono.ILASM {
get { return (meth_attr & PEAPI.MethAttr.Abstract) != 0; }
}
+ public Location StartLocation {
+ get { return start; }
+ }
+
public DeclSecurity DeclSecurity {
get {
if (decl_sec == null)
diff --git a/mcs/ilasm/codegen/TypeDef.cs b/mcs/ilasm/codegen/TypeDef.cs
index 34c52103c45..ea8a414262d 100644
--- a/mcs/ilasm/codegen/TypeDef.cs
+++ b/mcs/ilasm/codegen/TypeDef.cs
@@ -45,6 +45,8 @@ namespace Mono.ILASM {
private bool is_value_class;
private bool is_enum_class;
+ private Location location;
+
public TypeDef (PEAPI.TypeAttr attr, string name_space, string name,
BaseClassRef parent, ArrayList impl_list, Location location, GenericParameters gen_params, TypeDef outer)
{
@@ -53,6 +55,7 @@ namespace Mono.ILASM {
this.impl_list = impl_list;
this.gen_params = gen_params;
this.outer = outer;
+ this.location = location;
field_table = new Hashtable ();
field_list = new ArrayList ();
@@ -179,7 +182,7 @@ namespace Mono.ILASM {
public void AddFieldDef (FieldDef fielddef)
{
if (IsInterface && !fielddef.IsStatic) {
- Console.WriteLine ("warning -- Non-static field in interface, set to such");
+ Report.Warning ("Non-static field in interface, set to such");
fielddef.Attributes |= PEAPI.FieldAttr.Static;
}
@@ -193,12 +196,12 @@ namespace Mono.ILASM {
public void AddMethodDef (MethodDef methoddef)
{
if (IsInterface && !(methoddef.IsVirtual || methoddef.IsAbstract)) {
- Console.WriteLine ("warning -- Non-virtual, non-abstract instance method in interface, set to such");
+ Report.Warning (methoddef.StartLocation, "Non-virtual, non-abstract instance method in interface, set to such");
methoddef.Attributes |= PEAPI.MethAttr.Abstract | PEAPI.MethAttr.Virtual;
}
if (method_table [methoddef.Signature] != null)
- Report.Error ("Duplicate method declaration: " + methoddef.Signature);
+ Report.Error (methoddef.StartLocation, "Duplicate method declaration: " + methoddef.Signature);
method_table.Add (methoddef.Signature, methoddef);
}
@@ -316,7 +319,7 @@ namespace Mono.ILASM {
if (vis == PEAPI.TypeAttr.Private || vis == PEAPI.TypeAttr.Public) {
/* Nested class, but attr not set accordingly. */
- Console.WriteLine ("Warning -- Nested class '{0}' has non-nested visibility, set to such.", NestedFullName);
+ Report.Warning (location, String.Format ("Nested class '{0}' has non-nested visibility, set to such.", NestedFullName));
attr = attr ^ vis;
attr |= (vis == PEAPI.TypeAttr.Public ? PEAPI.TypeAttr.NestedPublic : PEAPI.TypeAttr.NestedPrivate);
}
@@ -340,7 +343,7 @@ namespace Mono.ILASM {
if (!IsValueType (name_space, name) && !IsEnumType (name_space, name) &&
is_value_class && (attr & PEAPI.TypeAttr.Sealed) == 0) {
- Console.WriteLine ("Warning -- Non-sealed value class, made sealed.");
+ Report.Warning (location, "Non-sealed value class, made sealed.");
attr |= PEAPI.TypeAttr.Sealed;
}
diff --git a/mcs/ilasm/parser/ChangeLog b/mcs/ilasm/parser/ChangeLog
index 3987b9d7d09..470b98ef8b2 100644
--- a/mcs/ilasm/parser/ChangeLog
+++ b/mcs/ilasm/parser/ChangeLog
@@ -1,3 +1,8 @@
+2006-06-07 Ankit Jain <jankit@novell.com>
+
+ * ILParser.jay : Update to use Report.Warning instead of
+ Console.Error.WriteLine
+
2006-06-01 Ankit Jain <jankit@novell.com>
* ILParser.jay (instr | INSTR_PARAM ..): Report error if the param is not
diff --git a/mcs/ilasm/parser/ILParser.jay b/mcs/ilasm/parser/ILParser.jay
index 27768ff51b3..c7dc4318018 100644
--- a/mcs/ilasm/parser/ILParser.jay
+++ b/mcs/ilasm/parser/ILParser.jay
@@ -60,7 +60,7 @@ namespace Mono.ILASM {
if ((action == System.Security.Permissions.SecurityAction.RequestMinimum ||
action == System.Security.Permissions.SecurityAction.RequestOptional ||
action == System.Security.Permissions.SecurityAction.RequestRefuse) && !for_assembly) {
- Console.Error.WriteLine (String.Format ("System.Security.Permissions.SecurityAction '{0}' is not valid for this declaration", action));
+ Report.Warning (String.Format ("System.Security.Permissions.SecurityAction '{0}' is not valid for this declaration", action));
return false;
}
@@ -2142,7 +2142,7 @@ method_decl : D_EMITBYTE int32
codegen.CurrentCustomAttrTarget = param;
if (param == null) {
- Console.Error.WriteLine ("{0} Warning -- invalid param index ({1}) with .param", tokenizer.Location, index);
+ Report.Warning (tokenizer.Location, String.Format ("invalid param index ({0}) with .param", index));
break;
}
if ($5 != null)