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_lvalue.tc,1.45,1.46 cs_g


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_lvalue.tc,1.45,1.46 cs_grammar.y,1.58,1.59
Date: Thu, 29 May 2003 16:59:30 -0400

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

Modified Files:
        cs_lvalue.tc cs_grammar.y 
Log Message:
Minoar fixes to IndexerName handling and remove a couple of compiler
warnings


Index: cs_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lvalue.tc,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -r1.45 -r1.46
*** cs_lvalue.tc        29 May 2003 16:58:33 -0000      1.45
--- cs_lvalue.tc        29 May 2003 20:59:27 -0000      1.46
***************
*** 1173,1177 ****
  {
        CSSemValue value;
-       CSSemValue value2;
        int savedState = info->inSemType;
        char *name;
--- 1173,1176 ----
***************
*** 1252,1256 ****
        CSSemValue indexers;
        CSEvalArg *args;
!       int numArgs, argNum;
        unsigned long itemNum;
        ILProgramItem *itemInfo;
--- 1251,1255 ----
        CSSemValue indexers;
        CSEvalArg *args;
!       int numArgs;
        unsigned long itemNum;
        ILProgramItem *itemInfo;
***************
*** 1259,1263 ****
        ILMethod *setMethod;
        ILType *objectType;
-       ILNode *tempNode;
        
        /* Bail out if "base" is used within a static method */
--- 1258,1261 ----

Index: cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -r1.58 -r1.59
*** cs_grammar.y        24 May 2003 01:50:52 -0000      1.58
--- cs_grammar.y        29 May 2003 20:59:27 -0000      1.59
***************
*** 335,341 ****
  }
  
  /* A hack to rename the indexer during parsing , damn the C# designers,
   * they had to make the variable names resolved later using an attribute
!  * public int <name>[int posn] would have been a cleaner design 
   */
  static ILNode *GetIndexerName(ILGenInfo *info,ILNode_AttributeTree *attrTree,
--- 335,370 ----
  }
  
+ /*
+  * Modify an attribute name so that it ends in "Attribute".
+  */
+ static void ModifyAttrName(ILNode *node,int force)
+ {
+       char *name;
+       int namelen;
+       ILNode_Identifier *ident;
+       
+       if(yyisa(node,ILNode_QualIdent))
+       {
+               ModifyAttrName(((ILNode_QualIdent*)node)->right, force);
+               return;
+       }
+       
+       ident = (ILNode_Identifier*) node;
+       
+       name = ident->name;
+       namelen = strlen(name);
+       if(force || (namelen < 9 || strcmp(name + namelen - 9, "Attribute") != 
0))
+       {
+               ident->name = ILInternAppendedString
+                       (ILInternString(name, namelen),
+                        ILInternString("Attribute", 9)).string;
+       }
+ }
+ 
  /* A hack to rename the indexer during parsing , damn the C# designers,
   * they had to make the variable names resolved later using an attribute
!  * public int <name>[int posn] would have been a cleaner design. But
!  * This is an UGLY hack and should be removed as soon as someone figures
!  * out how .
   */
  static ILNode *GetIndexerName(ILGenInfo *info,ILNode_AttributeTree *attrTree,
***************
*** 349,352 ****
--- 378,388 ----
        ILEvalValue evalValue;
        char* prefix=(prefixName) ? ILQualIdentName(prefixName,0) : NULL;
+       int i;
+ 
+       const char* possibleWays[] = {"IndexerName", "IndexerNameAttribute",
+                                       
"System.Runtime.CompilerServices.IndexerNameAttribute",
+                                       
"System.Runtime.CompilerServices.IndexerName"};
+       int isIndexerName=0;
+       
        if(attrTree && attrTree->sections)
        {
***************
*** 359,365 ****
                        while((attr = ILNode_ListIter_Next(&iter2))!=0)
                        {
!                               
if(!strcmp(ILQualIdentName(((ILNode_Attribute*)attr)->name,0)
!                                                       ,"IndexerName"))
                                {
                                        args=(ILNode_List*)((ILNode_AttrArgs*)
                                                
(((ILNode_Attribute*)attr)->args))->positionalArgs;     
--- 395,413 ----
                        while((attr = ILNode_ListIter_Next(&iter2))!=0)
                        {
!                               for(i=0;i<sizeof(possibleWays)/sizeof(char*); 
i++)
!                               {
!                                       isIndexerName |= !strcmp(
!                                                       
ILQualIdentName(((ILNode_Attribute*)attr)->name,0)
!                                                       ,possibleWays[i]);
!                               }
!                               if(isIndexerName)
                                {
+                                       /* NOTE: we make it 
+                                       
[System.Runtime.CompilerServices.IndexerNameAttribute]
+                                       for the sake of resolution...This too 
is too ugly a 
+                                       hack.
+                                       */
+                                       
ModifyAttrName(((ILNode_Attribute*)attr)->name,0);
+ 
                                        args=(ILNode_List*)((ILNode_AttrArgs*)
                                                
(((ILNode_Attribute*)attr)->args))->positionalArgs;     





reply via email to

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