Author: martin
Date: 2005-05-04 03:08:05 -0400 (Wed, 04 May 2005)
New Revision: 44005
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/statement.cs
Log:
2005-05-04 Martin Baulig <[EMAIL PROTECTED]>
Fix #70400.
* statement.cs (Switch): Replaced the `got_default' field with a
`default_section' one.
(Switch.CheckSwitch): Set `default_section' here.
(Switch.Resolve): If we're a constant switch and the constant is
not found, use the default section.
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-05-04 06:06:08 UTC (rev 44004)
+++ trunk/mcs/gmcs/ChangeLog 2005-05-04 07:08:05 UTC (rev 44005)
@@ -1,3 +1,13 @@
+2005-05-04 Martin Baulig <[EMAIL PROTECTED]>
+
+ Fix #70400.
+
+ * statement.cs (Switch): Replaced the `got_default' field with a
+ `default_section' one.
+ (Switch.CheckSwitch): Set `default_section' here.
+ (Switch.Resolve): If we're a constant switch and the constant is
+ not found, use the default section.
+
2005-05-03 Martin Baulig <[EMAIL PROTECTED]>
* expression.cs (ArrayAccess.EmitGetLength): New public method.
Modified: trunk/mcs/gmcs/statement.cs
===================================================================
--- trunk/mcs/gmcs/statement.cs 2005-05-04 06:06:08 UTC (rev 44004)
+++ trunk/mcs/gmcs/statement.cs 2005-05-04 07:08:05 UTC (rev 44005)
@@ -2327,11 +2327,11 @@
//
// Computed
//
- bool got_default;
Label default_target;
Expression new_expr;
bool is_constant;
SwitchSection constant_section;
+ SwitchSection default_section;
//
// The types allowed to be implicitly cast from
@@ -2348,7 +2348,7 @@
public bool GotDefault {
get {
- return got_default;
+ return default_section != null;
}
}
@@ -2453,8 +2453,6 @@
bool error = false;
Elements = new Hashtable ();
- got_default = false;
-
if (TypeManager.IsEnumType (SwitchType)){
compare_type = TypeManager.EnumToUnderlying
(SwitchType);
} else
@@ -2468,11 +2466,11 @@
}
if (sl.Label == null){
- if (got_default){
+ if (default_section != null){
Report.Error (152,
sl.loc, Error152, "default");
error = true;
}
- got_default = true;
+ default_section = ss;
continue;
}
@@ -3012,6 +3010,8 @@
SwitchLabel label = (SwitchLabel) Elements
[key];
constant_section = FindSection (label);
+ if (constant_section == null)
+ constant_section = default_section;
}
bool first = true;
@@ -3031,11 +3031,11 @@
return false;
} else {
if (!ss.Block.Resolve (ec))
- return false;
+ return false;
}
}
- if (!got_default)
+ if (default_section == null)
ec.CurrentBranching.CreateSibling (
null,
FlowBranching.SiblingType.SwitchSection);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches