dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/codegen cg_coerce.c,1.16,1.17


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/codegen cg_coerce.c,1.16,1.17
Date: Mon, 18 Nov 2002 18:35:41 -0500

Update of /cvsroot/dotgnu-pnet/pnet/codegen
In directory subversions:/tmp/cvs-serv602/codegen

Modified Files:
        cg_coerce.c 
Log Message:
fixup explicit checks for GetIndirectConvertRules


Index: cg_coerce.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_coerce.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** cg_coerce.c 16 Nov 2002 09:11:07 -0000      1.16
--- cg_coerce.c 18 Nov 2002 23:35:37 -0000      1.17
***************
*** 531,535 ****
                                                         
IL_META_METHODDEF_RT_SPECIAL_NAME)
  
! int GetIndirectConvertRules(ILGenInfo *info, ILType *fromType,
                                                   ILType *toType, int explicit,
                                                   int kinds, ConvertRules 
*rules1,
--- 531,541 ----
                                                         
IL_META_METHODDEF_RT_SPECIAL_NAME)
  
! /*
!  * multiple convert rules are checked here . I have implemented only
!  * a 2 step conversion fromType->itype1->itype2->toType , more levels
!  * can be implemented  using an extra "indirect" nesting count . But
!  * this stops at 2 .
!  */
! static int GetIndirectConvertRules(ILGenInfo *info, ILType *fromType,
                                                   ILType *toType, int explicit,
                                                   int kinds, ConvertRules 
*rules1,
***************
*** 578,582 ****
                        }
                        argType=ILTypeGetParam(signature,1);
- 
                        if(ILCanCoerceKind(info,returnType,toType,kinds,0) && 
                                ILCanCoerceKind(info,fromType,argType,kinds,0))
--- 584,587 ----
***************
*** 584,589 ****
                                if(itype1)(*itype1)=argType;
                                if(itype2)(*itype2)=returnType;
!                               
GetConvertRules(info,fromType,argType,explicit,kinds,rules1);
!                               
GetConvertRules(info,returnType,toType,explicit,kinds,rules2);
                                return 1;
                        }
--- 589,594 ----
                                if(itype1)(*itype1)=argType;
                                if(itype2)(*itype2)=returnType;
!                               
GetConvertRules(info,fromType,argType,0,kinds,rules1);
!                               
GetConvertRules(info,returnType,toType,0,kinds,rules2);
                                return 1;
                        }
***************
*** 625,630 ****
                                if(itype1)(*itype1)=argType;
                                if(itype2)(*itype2)=returnType;
!                               
GetConvertRules(info,fromType,argType,explicit,kinds,rules1);
!                               
GetConvertRules(info,returnType,toType,explicit,kinds,rules2);
                                return 1;
                        }
--- 630,723 ----
                                if(itype1)(*itype1)=argType;
                                if(itype2)(*itype2)=returnType;
!                               
GetConvertRules(info,fromType,argType,0,kinds,rules1);
!                               
GetConvertRules(info,returnType,toType,0,kinds,rules2);
!                               return 1;
!                       }
!               }
!               arg2Class = ILClass_Parent(arg2Class);
!       }
! 
!       if(!explicit)return 0;
!       
!       /* start explicit checks */
!       arg1Class = ILTypeToClass(info, fromType);
!       arg2Class = ILTypeToClass(info, toType);        
!       while(arg1Class != 0)
!       {
!               arg1Class= ILClassResolve(arg1Class);
!               member=0;
!               while((member = ILClassNextMemberByKind
!                                       (arg1Class, member, 
IL_META_MEMBERKIND_METHOD)) != 0)
!               {
!                       /* Filter out members that aren't interesting */
!                       if(strcmp(ILMember_Name(member), "op_Explicit") != 0 ||
!                          (ILMember_Attrs(member) & METHOD_TYPE_ATTRS) !=
!                       (IL_META_METHODDEF_STATIC 
|IL_META_METHODDEF_SPECIAL_NAME))
!                       {
!                               continue;
!                       }
!                       method = (ILMethod *)member;
!                       /* Check that this is the signature we are interested 
in */
!                       signature = ILMethod_Signature(method);
!                       if(!ILType_IsMethod(signature))
!                       {
!                               continue;
!                       }
!                       returnType=ILTypeGetReturn(signature);
!                       if(ILTypeNumParams(signature)!=1)
!                       {
!                               continue;
!                       }
!                       argType=ILTypeGetParam(signature,1);
!                       
!                       /* coercion is automatically tried by casting */
!                       if(ILCanCastKind(info,returnType,toType,kinds,0) && 
!                               ILCanCastKind(info,fromType,argType,kinds,0))
!                       {
!                               if(itype1)(*itype1)=argType;
!                               if(itype2)(*itype2)=returnType;
!                               
GetConvertRules(info,fromType,argType,0,kinds,rules1);
!                               
GetConvertRules(info,returnType,toType,0,kinds,rules2);
!                               return 1;
!                       }
!               }
!               arg1Class = ILClass_Parent(arg1Class);
!       }
! 
!       while(arg2Class != 0)
!       {
!               arg2Class= ILClassResolve(arg2Class);
!               member=0;
!               while((member = ILClassNextMemberByKind
!                                       (arg2Class, member, 
IL_META_MEMBERKIND_METHOD)) != 0)
!               {
!                       /* Filter out members that aren't interesting */
!                       if(strcmp(ILMember_Name(member), "op_Explicit") != 0 ||
!                          (ILMember_Attrs(member) & METHOD_TYPE_ATTRS) !=
!                       (IL_META_METHODDEF_STATIC 
|IL_META_METHODDEF_SPECIAL_NAME))
!                       {
!                               continue;
!                       }
!                       method = (ILMethod *)member;
!                       /* Check that this is the signature we are interested 
in */
!                       signature = ILMethod_Signature(method);
!                       if(!ILType_IsMethod(signature))
!                       {
!                               continue;
!                       }
!                       returnType=ILTypeGetReturn(signature);
!                       if(ILTypeNumParams(signature)!=1)
!                       {
!                               continue;
!                       }
!                       argType=ILTypeGetParam(signature,1);
! 
!                       if(ILCanCastKind(info,returnType,toType,kinds,0) && 
!                               ILCanCastKind(info,fromType,argType,kinds,0))
!                       {
!                               if(itype1)(*itype1)=argType;
!                               if(itype2)(*itype2)=returnType;
!                               
GetConvertRules(info,fromType,argType,0,kinds,rules1);
!                               
GetConvertRules(info,returnType,toType,0,kinds,rules2);
                                return 1;
                        }
***************
*** 963,967 ****
                return 1;
        }
!       else if(indirect && GetIndirectConvertRules(info,fromType,toType,0, 
                                                                        
kinds,&rules,&rules2,NULL,NULL))
        {
--- 1056,1060 ----
                return 1;
        }
!       else if(indirect && GetIndirectConvertRules(info,fromType,toType,1, 
                                                                        
kinds,&rules,&rules2,NULL,NULL))
        {
***************
*** 982,986 ****
                return 1;
        }
!       else if(GetIndirectConvertRules(info,fromType,toType,0, 
                                                        
IL_CONVERT_ALL,&rules,&rules2,&t1,&t2))
        {
--- 1075,1079 ----
                return 1;
        }
!       else if(GetIndirectConvertRules(info,fromType,toType,1, 
                                                        
IL_CONVERT_ALL,&rules,&rules2,&t1,&t2))
        {
***************
*** 1008,1012 ****
                return 1;
        }
!       else if(indirect && GetIndirectConvertRules(info,fromType,toType,0, 
                                                                        
kinds,&rules,&rules2,&t1,&t2))
        {
--- 1101,1105 ----
                return 1;
        }
!       else if(indirect && GetIndirectConvertRules(info,fromType,toType,1, 
                                                                        
kinds,&rules,&rules2,&t1,&t2))
        {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]