return new EmptyCast (expr, target_type);
// from any delegate type to System.Delegate
- if (expr_type.IsSubclassOf (TypeManager.delegate_type) &&
+ if ((expr_type == TypeManager.delegate_type ||
+ expr_type.IsSubclassOf (TypeManager.delegate_type)) &&
target_type == TypeManager.delegate_type)
return new EmptyCast (expr, target_type);
// from any array-type or delegate type into System.ICloneable.
- if (expr_type.IsArray || expr_type.IsSubclassOf (TypeManager.delegate_type))
+ if (expr_type.IsArray ||
+ expr_type == TypeManager.delegate_type ||
+ expr_type.IsSubclassOf (TypeManager.delegate_type))
if (target_type == TypeManager.icloneable_type)
return new EmptyCast (expr, target_type);
return true;
// from any delegate type to System.Delegate
- if (expr_type.IsSubclassOf (TypeManager.delegate_type) &&
+ if ((expr_type == TypeManager.delegate_type ||
+ expr_type.IsSubclassOf (TypeManager.delegate_type)) &&
target_type == TypeManager.delegate_type)
if (target_type.IsAssignableFrom (expr_type))
return true;
// from any array-type or delegate type into System.ICloneable.
- if (expr_type.IsArray || expr_type.IsSubclassOf (TypeManager.delegate_type))
+ if (expr_type.IsArray ||
+ expr_type == TypeManager.delegate_type ||
+ expr_type.IsSubclassOf (TypeManager.delegate_type))
if (target_type == TypeManager.icloneable_type)
return true;
return true;
}
- if (target_type.IsSubclassOf (TypeManager.enum_type) && expr is IntLiteral){
+ if ((target_type == TypeManager.enum_type ||
+ target_type.IsSubclassOf (TypeManager.enum_type)) &&
+ expr is IntLiteral){
IntLiteral i = (IntLiteral) expr;
if (i.Value == 0)
if (e != null)
return e;
- if (target_type.IsSubclassOf (TypeManager.enum_type) && expr is IntLiteral){
+ if ((target_type == TypeManager.enum_type ||
+ target_type.IsSubclassOf (TypeManager.enum_type)) &&
+ expr is IntLiteral){
IntLiteral i = (IntLiteral) expr;
if (i.Value == 0)
// a TypeBuilder array will return a Type, not a TypeBuilder,
// and we can not call FindMembers on this type.
//
- if (t.IsSubclassOf (TypeManager.array_type)) {
+ if (t == TypeManager.array_type || t.IsSubclassOf (TypeManager.array_type)) {
used_cache = true;
return TypeHandle.ArrayType.MemberCache.FindMembers (
mt, bf, name, FilterWithClosure_delegate, null);
public static bool IsEnumType (Type t)
{
- if (t.IsSubclassOf (TypeManager.enum_type))
+ if (t == TypeManager.enum_type || t.IsSubclassOf (TypeManager.enum_type))
return true;
else
return false;