Author: jambunathan
Date: 2005-05-07 16:50:53 -0400 (Sat, 07 May 2005)
New Revision: 44208
Modified:
trunk/mcs/bmcs/ChangeLog
trunk/mcs/bmcs/expression.cs
Log:
* expression.cs (Binary.CheckIsArguments): Added
(Binary.Emit, Binary.CheckArguments): Modified to support 'Is'
operator.
Modified: trunk/mcs/bmcs/ChangeLog
===================================================================
--- trunk/mcs/bmcs/ChangeLog 2005-05-07 20:19:34 UTC (rev 44207)
+++ trunk/mcs/bmcs/ChangeLog 2005-05-07 20:50:53 UTC (rev 44208)
@@ -1,5 +1,11 @@
-2005-05-01 Jambunathan K <[EMAIL PROTECTED]>
+2005-05-08 Jambunathan K <[EMAIL PROTECTED]>
+ * expression.cs (Binary.CheckIsArguments): Added
+ (Binary.Emit, Binary.CheckArguments): Modified to support 'Is'
+ operator.
+
+2005-05-08 Jambunathan K <[EMAIL PROTECTED]>
+
* convert.cs:
* expression.cs: Miscellaneous fixes relating to
type conversions.
Modified: trunk/mcs/bmcs/expression.cs
===================================================================
--- trunk/mcs/bmcs/expression.cs 2005-05-07 20:19:34 UTC (rev 44207)
+++ trunk/mcs/bmcs/expression.cs 2005-05-07 20:50:53 UTC (rev 44208)
@@ -2301,6 +2301,45 @@
right = new Binary (Binary.Operator.BitwiseAnd, right,
new IntLiteral (mask), loc);
right = right.DoResolve (ec);
}
+
+ void CheckIsArguments (EmitContext ec)
+ {
+ Type l = left.Type;
+ Type r = right.Type;
+ Type = TypeManager.bool_type;
+
+ bool left_is_null = left is NullLiteral;
+ bool right_is_null = right is NullLiteral;
+
+ if (left_is_null || right_is_null)
+ return;
+
+ if (l.IsValueType || r.IsValueType) {
+ Error_OperatorCannotBeApplied ();
+ return;
+ }
+
+
+ if (l == r)
+ return;
+
+ if (l.IsSubclassOf (r) || r.IsSubclassOf (l))
+ return;
+
+ if (!(Convert.WideningStandardConversionExists
(ec, left, right.Type) ||
+ Convert.WideningStandardConversionExists
(ec, right, left.Type))){
+ Error_OperatorCannotBeApplied ();
+ return;
+ }
+
+ if (left.Type != TypeManager.object_type)
+ left = new EmptyCast (left,
TypeManager.object_type);
+ if (right.Type != TypeManager.object_type)
+ right = new EmptyCast (right,
TypeManager.object_type);
+
+ return;
+ }
+
#if false
Expression ResolveOperator (EmitContext ec)
@@ -3076,6 +3115,7 @@
opcode = OpCodes.Shl;
break;
+ case Operator.Is:
case Operator.Equality:
opcode = OpCodes.Ceq;
break;
@@ -3285,7 +3325,7 @@
Expression target_left_expr = left;
Expression target_right_expr = right;
- if (IsShortCircuitedLogicalExpression)
+ if (IsShortCircuitedLogicalExpression || IsExpression)
return null;
if (l != TypeManager.object_type && r !=
TypeManager.object_type)
@@ -3365,6 +3405,11 @@
return;
}
+ if (IsExpression) {
+ CheckIsArguments (ec);
+ return;
+ }
+
while (true) {
++step;
@@ -3719,6 +3764,12 @@
}
}
+ bool IsExpression {
+ get {
+ return (oper == Operator.Is);
+ }
+ }
+
MethodInfo HelperMethod {
get {
MethodInfo helper_method = null;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches