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

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

[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_attrs.c,1.23,1.24


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_attrs.c,1.23,1.24
Date: Fri, 02 May 2003 12:56:15 -0400

Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv23299/cscc/csharp

Modified Files:
        cs_attrs.c 
Log Message:
Fixes bug #2556 - object coercions for attribute parameters


Index: cs_attrs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_attrs.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** cs_attrs.c  2 May 2003 11:21:35 -0000       1.23
--- cs_attrs.c  2 May 2003 16:56:13 -0000       1.24
***************
*** 237,248 ****
  /* 
   * write an entry into the serialized stream using the provide paramType and
!  * argValue and serialType 
   */
  
! static void WriteSerializedEntry(ILSerializeWriter *writer, 
                                                                 ILType 
*paramType,
                                                                 ILEvalValue 
*argValue,
                                                                 int serialType)
! {
        switch(serialType)
        {
--- 237,252 ----
  /* 
   * write an entry into the serialized stream using the provide paramType and
!  * argValue and serialType. 
   */
  
! static void WriteSerializedEntry(ILGenInfo *info,
!                                                                
ILSerializeWriter *writer, 
                                                                 ILType 
*paramType,
                                                                 ILEvalValue 
*argValue,
+                                                                ILType 
*argType,
                                                                 int serialType)
! {     
!       ILType *systemType=ILFindSystemType(info,"Type");
! 
        switch(serialType)
        {
***************
*** 297,301 ****
                default:
                {
!                       /* TODO: arrays and implicit coercions to Object */
                }
                break;
--- 301,372 ----
                default:
                {
!                       /* Note : We assume the values are castable and
!                        * do not provide any checks here */
!                       if(ILType_IsArray(paramType))
!                       {
!                               /* TODO: arrays */
!                       }
!                       else if(ILType_IsPrimitive(argType))
!                       {
!                               switch(argValue->valueType)
!                               {       
!                                       case ILMachineType_Boolean:
!                                       case ILMachineType_Int8:
!                                       case ILMachineType_UInt8:
!                                       case ILMachineType_Int16:
!                                       case ILMachineType_UInt16:
!                                       case ILMachineType_Char:
!                                       case ILMachineType_Int32:
!                                       case ILMachineType_UInt32:
!                                       case ILMachineType_Int64:
!                                       case ILMachineType_UInt64:
!                                       case ILMachineType_Float32:
!                                       case ILMachineType_Float64:
!                                       case ILMachineType_Decimal:
!                                       {
!                                               
serialType=ILSerializeGetType(argType);
!                                               
!                                               
ILSerializeWriterSetBoxedPrefix(writer, 
!                                                                               
                                   serialType);
! 
!                                               WriteSerializedEntry(info, 
writer, paramType, 
!                                                                               
         argValue, argType, serialType);
!                                       }
!                                       break;
!                                       
!                                       case ILMachineType_String:
!                                       {
!                                               /* TODO */
!                                       }
!                                       break;
!                                       
!                                       default:
!                                       {
!                                       }
!                                       break;
!                               }
!                       }
!                       else if(ILTypeIdentical(argType, systemType))
!                       { 
!                               ILSerializeWriterSetBoxedPrefix(writer,
!                                                                               
IL_META_SERIALTYPE_TYPE);
!                               
!                               WriteSerializedEntry(info, writer, paramType, 
!                                                                        
argValue, argType,
!                                                                        
IL_META_SERIALTYPE_TYPE);
!                       }
!                       else if(ILTypeIsEnum(argType))
!                       {
!                               const char *name = CSTypeToName ((ILType 
*)(argType));
!                               ILSerializeWriterSetBoxedPrefix(writer,
!                                                                               
IL_META_SERIALTYPE_ENUM);
!                               ILSerializeWriterSetString(writer, name, 
strlen(name));
! 
!                               serialType=ILSerializeGetType(argType);
! 
!                               WriteSerializedEntry(info, writer, paramType,
!                                                                               
argValue, argType,
!                                                                               
serialType);    
!                       }
                }
                break;
***************
*** 341,344 ****
--- 412,416 ----
        int retry;
        int skipConst;
+       ILType *argType;
  
        /* Hack: recognize "System.AttributeUsage" and add "Attribute".
***************
*** 720,728 ****
                                                           
ILTypeToMachineType(paramType)))
                        {
!                               
CCErrorOnLine(yygetfilename(evalArgs[argNum].node),
!                                                         
yygetlinenum(evalArgs[argNum].node),
!                                                         _("could not coerce 
constant argument %d"),
!                                                         argNum + 1);
!                               haveErrors = 1;
                        }
                        else if(ILSerializeGetType(paramType) == -1)
--- 792,807 ----
                                                           
ILTypeToMachineType(paramType)))
                        {
!                               if(!ILCanCastKind(info, evalArgs[argNum].type,
!                                                       paramType,
!                                                       IL_CONVERT_STANDARD,
!                                                       0))
!                               {
!                                                               
!                                       
CCErrorOnLine(yygetfilename(evalArgs[argNum].node),
!                                                                 
yygetlinenum(evalArgs[argNum].node),
!                                                                 _("could not 
coerce constant argument %d"),
!                                                                 argNum + 1);
!                                       haveErrors = 1;
!                               }
                        }
                        else if(ILSerializeGetType(paramType) == -1)
***************
*** 751,756 ****
                paramType = ILTypeGetParam(signature, argNum + 1);
                argValue = &(evalValues[argNum]);
                serialType = ILSerializeGetType(paramType);
!               WriteSerializedEntry(writer,paramType,argValue,serialType);
        }
        ILSerializeWriterSetNumExtra(writer, numNamedArgs);
--- 830,836 ----
                paramType = ILTypeGetParam(signature, argNum + 1);
                argValue = &(evalValues[argNum]);
+               argType = evalArgs[argNum].type;
                serialType = ILSerializeGetType(paramType);
!               
WriteSerializedEntry(info,writer,paramType,argValue,argType,serialType);
        }
        ILSerializeWriterSetNumExtra(writer, numNamedArgs);
***************
*** 761,764 ****
--- 841,845 ----
                {
                        serialType = IL_META_SERIALTYPE_TYPE;
+                       paramType = NULL;
                }
                else
***************
*** 779,783 ****
                                 serialType);
                }
!               WriteSerializedEntry(writer,paramType,argValue,serialType);
        }
        blob = ILSerializeWriterGetBlob(writer, &blobLen);
--- 860,865 ----
                                 serialType);
                }
!               argType=namedArgs[argNum].type;
!               
WriteSerializedEntry(info,writer,paramType,argValue,argType,serialType);
        }
        blob = ILSerializeWriterGetBlob(writer, &blobLen);





reply via email to

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