Author: ankit
Date: 2006-06-01 06:32:30 -0400 (Thu, 01 Jun 2006)
New Revision: 61360
Added:
trunk/mcs/ilasm/errors/err-ldarg.il
Modified:
trunk/mcs/ilasm/codegen/ChangeLog
trunk/mcs/ilasm/codegen/MethodDef.cs
trunk/mcs/ilasm/errors/ChangeLog
trunk/mcs/ilasm/parser/ChangeLog
trunk/mcs/ilasm/parser/ILParser.jay
Log:
In ilasm/codegen:
* MethodDef.cs (GetNamedParamPos): Return -1 if param_list is null.
In ilasm/errors:
* err-ldarg.il: New.
In ilasm/parser:
* ILParser.jay (instr | INSTR_PARAM ..): Report error if the param is
not
found.
Modified: trunk/mcs/ilasm/codegen/ChangeLog
===================================================================
--- trunk/mcs/ilasm/codegen/ChangeLog 2006-06-01 09:56:15 UTC (rev 61359)
+++ trunk/mcs/ilasm/codegen/ChangeLog 2006-06-01 10:32:30 UTC (rev 61360)
@@ -1,5 +1,9 @@
2006-06-01 Ankit Jain <[EMAIL PROTECTED]>
+ * MethodDef.cs (GetNamedParamPos): Return -1 if param_list is null.
+
+2006-06-01 Ankit Jain <[EMAIL PROTECTED]>
+
* MethodDef.cs (MethodDef): Use a ParamDef for return type, instead of a
BaseTypeRef.
(MethodDef.ctor): Update.
Modified: trunk/mcs/ilasm/codegen/MethodDef.cs
===================================================================
--- trunk/mcs/ilasm/codegen/MethodDef.cs 2006-06-01 09:56:15 UTC (rev
61359)
+++ trunk/mcs/ilasm/codegen/MethodDef.cs 2006-06-01 10:32:30 UTC (rev
61360)
@@ -230,6 +230,9 @@
public int GetNamedParamPos (string name)
{
int pos = -1;
+ if (param_list == null)
+ return -1;
+
if (!IsStatic)
pos ++;
foreach (ParamDef param in param_list) {
Modified: trunk/mcs/ilasm/errors/ChangeLog
===================================================================
--- trunk/mcs/ilasm/errors/ChangeLog 2006-06-01 09:56:15 UTC (rev 61359)
+++ trunk/mcs/ilasm/errors/ChangeLog 2006-06-01 10:32:30 UTC (rev 61360)
@@ -1,5 +1,9 @@
2006-06-01 Ankit Jain <[EMAIL PROTECTED]>
+ * err-ldarg.il: New.
+
+2006-06-01 Ankit Jain <[EMAIL PROTECTED]>
+
* err-cattr.il: New.
2006-05-09 Ankit Jain <[EMAIL PROTECTED]>
Added: trunk/mcs/ilasm/errors/err-ldarg.il
===================================================================
--- trunk/mcs/ilasm/errors/err-ldarg.il 2006-06-01 09:56:15 UTC (rev 61359)
+++ trunk/mcs/ilasm/errors/err-ldarg.il 2006-06-01 10:32:30 UTC (rev 61360)
@@ -0,0 +1,28 @@
+// Test for accessing undeclared identifier (args here)
+
+.assembly extern mscorlib
+{
+ .ver 1:0:5000:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
+}
+.assembly 'arg'
+{
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module arg.exe
+
+ .class public auto ansi beforefieldinit test
+ extends [mscorlib]System.Object
+ {
+ .method public static hidebysig
+ default void Main () cil managed
+ {
+ .entrypoint
+ .maxstack 8
+ ldarg args
+ pop
+ IL_0012: ret
+ }
+
+ }
Modified: trunk/mcs/ilasm/parser/ChangeLog
===================================================================
--- trunk/mcs/ilasm/parser/ChangeLog 2006-06-01 09:56:15 UTC (rev 61359)
+++ trunk/mcs/ilasm/parser/ChangeLog 2006-06-01 10:32:30 UTC (rev 61360)
@@ -1,5 +1,10 @@
2006-06-01 Ankit Jain <[EMAIL PROTECTED]>
+ * ILParser.jay (instr | INSTR_PARAM ..): Report error if the param is
not
+ found.
+
+2006-06-01 Ankit Jain <[EMAIL PROTECTED]>
+
* ILParser.jay (method_decl | D_PARAM ..): Param index is zero-based,
with zero representing the return value.
Update to check CurrentCustomAttrTarget for null before using it.
Modified: trunk/mcs/ilasm/parser/ILParser.jay
===================================================================
--- trunk/mcs/ilasm/parser/ILParser.jay 2006-06-01 09:56:15 UTC (rev 61359)
+++ trunk/mcs/ilasm/parser/ILParser.jay 2006-06-01 10:32:30 UTC (rev 61360)
@@ -2378,6 +2378,9 @@
| INSTR_PARAM id
{
int pos =
codegen.CurrentMethodDef.GetNamedParamPos ((string) $2);
+ if (pos < 0)
+ Report.Error (String.Format
("Undeclared identifier '{0}'", (string) $2));
+
codegen.CurrentMethodDef.AddInstr (
new IntInstr ((IntOp) $1, pos,
tokenizer.Location));
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches