diff options
author | Ankit Jain <radical@corewars.org> | 2006-05-09 21:49:56 +0400 |
---|---|---|
committer | Ankit Jain <radical@corewars.org> | 2006-05-09 21:49:56 +0400 |
commit | e12df734e5637ea967ade30064c48e711c70d56e (patch) | |
tree | 8d42dba50ccbf3aff2e2b60097fc72e25e820ee5 | |
parent | f3c1074b8b3a9119421a9c7f6a41cd5bd1455adc (diff) |
In ilasm/codegen:
* MethodDef.cs (MethodDef.AddLabel): Throw exception for duplicate
labels.
In ilasm/errors:
* err-dup-label.il: New.
svn path=/branches/mono-1-1-13/mcs/; revision=60460
-rw-r--r-- | mcs/ilasm/codegen/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/ilasm/codegen/MethodDef.cs | 5 | ||||
-rw-r--r-- | mcs/ilasm/errors/ChangeLog | 4 | ||||
-rw-r--r-- | mcs/ilasm/errors/err-dup-label.il | 17 |
4 files changed, 29 insertions, 2 deletions
diff --git a/mcs/ilasm/codegen/ChangeLog b/mcs/ilasm/codegen/ChangeLog index 322b094d4df..c85afcd531b 100644 --- a/mcs/ilasm/codegen/ChangeLog +++ b/mcs/ilasm/codegen/ChangeLog @@ -1,3 +1,8 @@ +2006-05-09 Ankit Jain <jankit@novell.com> + + * MethodDef.cs (MethodDef.AddLabel): Throw exception for duplicate + labels. + 2006-05-09 Ankit Jain <jankit@novell.com> * CodeGen.cs (CodeGen.data_list): Change to .. diff --git a/mcs/ilasm/codegen/MethodDef.cs b/mcs/ilasm/codegen/MethodDef.cs index 8ed1268534e..cdb6943e703 100644 --- a/mcs/ilasm/codegen/MethodDef.cs +++ b/mcs/ilasm/codegen/MethodDef.cs @@ -558,9 +558,10 @@ namespace Mono.ILASM { { LabelInfo label_info = (LabelInfo) label_table[name]; if (label_info != null) - return label_info; + throw new ILAsmException ("Duplicate label: '{0}'" + name); + label_info = new LabelInfo (name, inst_list.Count); - label_table.Add (name, label_info); + label_table [name] = label_info; return label_info; } diff --git a/mcs/ilasm/errors/ChangeLog b/mcs/ilasm/errors/ChangeLog index 19b5e9e3da7..928561773ed 100644 --- a/mcs/ilasm/errors/ChangeLog +++ b/mcs/ilasm/errors/ChangeLog @@ -1,5 +1,9 @@ 2006-05-09 Ankit Jain <jankit@novell.com> + * err-dup-label.il: New. + +2006-05-09 Ankit Jain <jankit@novell.com> + * err-dup-datalabel.il: New. 2006-02-10 Ankit Jain <jankit@novell.com> diff --git a/mcs/ilasm/errors/err-dup-label.il b/mcs/ilasm/errors/err-dup-label.il new file mode 100644 index 00000000000..a28087faef6 --- /dev/null +++ b/mcs/ilasm/errors/err-dup-label.il @@ -0,0 +1,17 @@ +// Test for duplicate labels + +.assembly extern mscorlib { } + +.class public T { + + .method public static void main () + { + .entrypoint + + IL_0001: ldstr "Hello" + IL_0001: call void [mscorlib]System.Console::WriteLine(string) + ret + } + +} + |