Author: marek
Date: 2005-11-01 12:27:35 -0500 (Tue, 01 Nov 2005)
New Revision: 52452
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/ecore.cs
trunk/mcs/mcs/expression.cs
trunk/mcs/mcs/statement.cs
Log:
2005-11-01 Marek Safar <[EMAIL PROTECTED]>
Fix #76590.
* ecore.cs (NullCast.Reduce): Implemented.
* expression.cs (ArrayCreation.CheckIndices): Correcly check
constant type.
* statement.cs (SwitchLabel.ResolveAndReduce): Catch null
properly.
(Foreach.Resolve): Catch null properly.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2005-11-01 17:18:55 UTC (rev 52451)
+++ trunk/mcs/mcs/ChangeLog 2005-11-01 17:27:35 UTC (rev 52452)
@@ -1,3 +1,15 @@
+2005-11-01 Marek Safar <[EMAIL PROTECTED]>
+
+ Fix #76590.
+ * ecore.cs (NullCast.Reduce): Implemented.
+
+ * expression.cs (ArrayCreation.CheckIndices): Correcly check
+ constant type.
+
+ * statement.cs (SwitchLabel.ResolveAndReduce): Catch null
+ properly.
+ (Foreach.Resolve): Catch null properly.
+
2005-10-29 Marek Safar <[EMAIL PROTECTED]>
* cs-tokenizer.cs: Warning text fix.
Modified: trunk/mcs/mcs/ecore.cs
===================================================================
--- trunk/mcs/mcs/ecore.cs 2005-11-01 17:18:55 UTC (rev 52451)
+++ trunk/mcs/mcs/ecore.cs 2005-11-01 17:27:35 UTC (rev 52452)
@@ -1301,7 +1301,10 @@
public override Constant Reduce (EmitContext ec, Type
target_type)
{
- throw new NotImplementedException ();
+ if (type == target_type)
+ return child.Reduce (ec, target_type);
+
+ return null;
}
}
Modified: trunk/mcs/mcs/expression.cs
===================================================================
--- trunk/mcs/mcs/expression.cs 2005-11-01 17:18:55 UTC (rev 52451)
+++ trunk/mcs/mcs/expression.cs 2005-11-01 17:27:35 UTC (rev 52452)
@@ -5873,17 +5873,22 @@
{
if (specified_dims) {
Argument a = (Argument) arguments [idx];
-
+
if (!a.Resolve (ec, loc))
return false;
-
- if (!(a.Expr is Constant)) {
- Error (150, "A constant value is
expected");
+
+ Constant c = a.Expr as Constant;
+ if (c != null) {
+ c = c.ToType (TypeManager.int32_type,
a.Expr.Location);
+ }
+
+ if (c == null) {
+ Report.Error (150, a.Expr.Location, "A
constant value is expected");
return false;
}
+
+ int value = (int) c.GetValue ();
- int value = (int) ((Constant) a.Expr).GetValue
();
-
if (value != probe.Count) {
Error_IncorrectArrayInitializer ();
return false;
Modified: trunk/mcs/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs 2005-11-01 17:18:55 UTC (rev 52451)
+++ trunk/mcs/mcs/statement.cs 2005-11-01 17:27:35 UTC (rev 52452)
@@ -2359,7 +2359,7 @@
return false;
}
- if (required_type == TypeManager.string_type && e is
NullLiteral) {
+ if (required_type == TypeManager.string_type &&
c.GetValue () == null) {
converted = NullStringCase;
return true;
}
@@ -2377,7 +2377,7 @@
string label;
if (converted == null)
label = "default";
- else if (converted is NullLiteral)
+ else if (converted == NullStringCase)
label = "null";
else
label = converted.ToString ();
@@ -4130,7 +4130,8 @@
if (expr == null)
return false;
- if (expr is NullLiteral) {
+ Constant c = expr as Constant;
+ if (c != null && c.GetValue () == null) {
Report.Error (186, loc, "Use of null is not
valid in this context");
return false;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches