-2005-05-01 Jambunathan K <kjambunathan.devel@gmail.com>
+2005-05-08 Jambunathan K <kjambunathan.devel@gmail.com>
+
+ * expression.cs (Binary.CheckIsArguments): Added
+ (Binary.Emit, Binary.CheckArguments): Modified to support 'Is'
+ operator.
+
+2005-05-08 Jambunathan K <kjambunathan.devel@gmail.com>
* convert.cs:
* expression.cs: Miscellaneous fixes relating to
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)
opcode = OpCodes.Shl;
break;
+ case Operator.Is:
case Operator.Equality:
opcode = OpCodes.Ceq;
break;
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)
return;
}
+ if (IsExpression) {
+ CheckIsArguments (ec);
+ return;
+ }
+
while (true) {
++step;
}
}
+ bool IsExpression {
+ get {
+ return (oper == Operator.Is);
+ }
+ }
+
MethodInfo HelperMethod {
get {
MethodInfo helper_method = null;