diff options
author | Rodrigo Kumpera <kumpera@gmail.com> | 2007-12-31 17:35:05 +0300 |
---|---|---|
committer | Rodrigo Kumpera <kumpera@gmail.com> | 2007-12-31 17:35:05 +0300 |
commit | 12829754cf73e561c3a7412273931b5d19394299 (patch) | |
tree | cd9af49cb8cfe573264affc4c2d0d1e8184d63c5 /mcs/ilasm | |
parent | 4405429b17390168a7ada0d46b970b29a183eeee (diff) |
In codegen:
2007-12-31 Rodrigo Kumpera <rkumpera@novell.com>
* SwitchInstr.cs (Emit): Switch from using strings
to LabelInfo.
In parser:
2007-12-31 Rodrigo Kumpera <rkumpera@novell.com>
* ILParser.jay: Create LabelInfo instances for switch labels,
this allows the code generator to spot invalid labels.
Fixes #350480.
svn path=/trunk/mcs/; revision=92061
Diffstat (limited to 'mcs/ilasm')
-rw-r--r-- | mcs/ilasm/codegen/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/ilasm/codegen/SwitchInstr.cs | 4 | ||||
-rw-r--r-- | mcs/ilasm/parser/ChangeLog | 8 | ||||
-rw-r--r-- | mcs/ilasm/parser/ILParser.jay | 4 |
4 files changed, 16 insertions, 5 deletions
diff --git a/mcs/ilasm/codegen/ChangeLog b/mcs/ilasm/codegen/ChangeLog index f3de34daf0b..c4f8f141a87 100644 --- a/mcs/ilasm/codegen/ChangeLog +++ b/mcs/ilasm/codegen/ChangeLog @@ -1,3 +1,8 @@ +2007-12-31 Rodrigo Kumpera <rkumpera@novell.com> + + * SwitchInstr.cs (Emit): Switch from using strings + to LabelInfo. + 2007-10-09 Rodrigo Kumpera <rkumpera@novell.com> * MethodPointerTypeRef.cs (.ctor): generate diff --git a/mcs/ilasm/codegen/SwitchInstr.cs b/mcs/ilasm/codegen/SwitchInstr.cs index 5b6178ee15b..810e779628d 100644 --- a/mcs/ilasm/codegen/SwitchInstr.cs +++ b/mcs/ilasm/codegen/SwitchInstr.cs @@ -32,8 +32,8 @@ namespace Mono.ILASM { if (label_list != null) { label_array = new PEAPI.CILLabel[label_list.Count]; foreach (object lab in label_list) { - if (lab is string) { - label_array[count++] = meth.GetLabelDef ((string) lab); + if (lab is LabelInfo) { + label_array[count++] = ((LabelInfo)lab).Label; } else { throw new InternalErrorException ("offsets in switch statements."); } diff --git a/mcs/ilasm/parser/ChangeLog b/mcs/ilasm/parser/ChangeLog index 62578cc2c11..dbec8c35cf7 100644 --- a/mcs/ilasm/parser/ChangeLog +++ b/mcs/ilasm/parser/ChangeLog @@ -1,4 +1,10 @@ -2006-06-05 Rodrigo Kumpera <kumpera@gmail.com> +2007-12-31 Rodrigo Kumpera <rkumpera@novell.com> + + * ILParser.jay: Create LabelInfo instances for switch labels, + this allows the code generator to spot invalid labels. + Fixes #350480. + +2007-06-05 Rodrigo Kumpera <kumpera@gmail.com> * ILParser.jay: Support for variance related generic modifiers <+T> and <-T> diff --git a/mcs/ilasm/parser/ILParser.jay b/mcs/ilasm/parser/ILParser.jay index c88d1bdd51c..9164b67ba19 100644 --- a/mcs/ilasm/parser/ILParser.jay +++ b/mcs/ilasm/parser/ILParser.jay @@ -2602,7 +2602,7 @@ labels : /* EMPTY */ | id
{
ArrayList label_list = new ArrayList ();
- label_list.Add ($1);
+ label_list.Add (codegen.CurrentMethodDef.AddLabelRef ((string) $1));
$$ = label_list;
}
| int32
@@ -2614,7 +2614,7 @@ labels : /* EMPTY */ | labels COMMA id
{
ArrayList label_list = (ArrayList) $1;
- label_list.Add ($3);
+ label_list.Add (codegen.CurrentMethodDef.AddLabelRef ((string) $3));
}
| labels COMMA int32
{
|