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.13,1.14


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_attrs.c,1.13,1.14
Date: Sun, 12 Jan 2003 00:43:39 -0500

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

Modified Files:
        cs_attrs.c 
Log Message:


Clean up the code that checks for attributes with and without "Attribute"
appended so that it will also work for attribute classes whose names don't
end in "Attribute" at all.


Index: cs_attrs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_attrs.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** cs_attrs.c  17 Dec 2002 17:31:28 -0000      1.13
--- cs_attrs.c  12 Jan 2003 05:43:36 -0000      1.14
***************
*** 245,305 ****
        unsigned long blobLen;
        ILAttribute *attribute;
!       ILNode *nameNode=NULL;
!       int alreadySeen=0;
  
!       /* Make sure that the attribute type name ends in "Attribute" */
!       if(yyisa(attr->name, ILNode_Identifier))
        {
!               ModifyAttrName((ILNode_Identifier *)(attr->name),0);
!       }
!       else if(yyisa(attr->name, ILNode_QualIdent))
!       {
!               ModifyAttrName
!                 ((ILNode_Identifier *)(((ILNode_QualIdent 
*)(attr->name))->right),0);
!       }
! 
!       nameNode=attr->name;
!       if(!CSSemExpectType(attr->name,info,&(attr->name)))
!       {
!               /* restore and rename */
!               attr->name=nameNode;
!               /* Make sure that the attribute type name ends in "Attribute" */
!               if(yyisa(attr->name, ILNode_Identifier))
!               {
!                       ModifyAttrName((ILNode_Identifier *)(attr->name),1);
!               }
!               else if(yyisa(attr->name, ILNode_QualIdent))
                {
!                       ModifyAttrName((ILNode_Identifier *)(((ILNode_QualIdent 
*)
!                                                                               
        (attr->name))->right),1);
                }
-               alreadySeen=1;
        }
-       
-       /* Perform semantic analysis on the attribute type */
-       type = CSSemType(attr->name, info, &(attr->name));
  
!       /* To handle stuff like System.Xml.XmlAttribute which is not an
!        * attribute, but there is 
System.Xml.Serialization.XmlAttributeAttribute
!        * which is also [XmlAttribute]
!        */
!       if((!alreadySeen) && (!ILTypeAssignCompatible
!                       (info->image, type, ILFindSystemType(info, 
"Attribute"))))
        {
!               attr->name=nameNode;
!               /* Make sure that the attribute type name ends in "Attribute" */
                if(yyisa(attr->name, ILNode_Identifier))
                {
!                       ModifyAttrName((ILNode_Identifier *)(attr->name),1);
                }
                else if(yyisa(attr->name, ILNode_QualIdent))
                {
                        ModifyAttrName((ILNode_Identifier *)(((ILNode_QualIdent 
*)
!                                                                               
        (attr->name))->right),1);
                }
-               /* Perform semantic analysis on the attribute type */
                type = CSSemType(attr->name, info, &(attr->name));
        }
! 
        /* The type must inherit from "System.Attribute" and not be abstract */
        if(!ILTypeAssignCompatible
--- 245,281 ----
        unsigned long blobLen;
        ILAttribute *attribute;
!       ILNode *nameNode;
!       int retry;
  
!       /* Try the attribute name without "Attribute" first */
!       nameNode = attr->name;
!       retry = 1;
!       type = 0;
!       if(CSSemExpectType(attr->name, info, &(attr->name)))
        {
!               type = CSSemType(attr->name, info, &(attr->name));
!           if(ILTypeAssignCompatible(info->image, type,
!                                                             
ILFindSystemType(info, "Attribute")))
                {
!                       retry = 0;
                }
        }
  
!       /* Retry with "Attribute" appended to the name if necessary */
!       if(retry)
        {
!               attr->name = nameNode;
                if(yyisa(attr->name, ILNode_Identifier))
                {
!                       ModifyAttrName((ILNode_Identifier *)(attr->name), 1);
                }
                else if(yyisa(attr->name, ILNode_QualIdent))
                {
                        ModifyAttrName((ILNode_Identifier *)(((ILNode_QualIdent 
*)
!                                                                               
        (attr->name))->right), 1);
                }
                type = CSSemType(attr->name, info, &(attr->name));
        }
!       
        /* The type must inherit from "System.Attribute" and not be abstract */
        if(!ILTypeAssignCompatible





reply via email to

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