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_decls.tc,1.31,1.32


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_decls.tc,1.31,1.32
Date: Fri, 14 Feb 2003 09:06:50 -0500

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

Modified Files:
        cs_decls.tc 
Log Message:
re-order static constructors to move the explicit static ctor to the last


Index: cs_decls.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_decls.tc,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** cs_decls.tc 19 Jan 2003 07:18:43 -0000      1.31
--- cs_decls.tc 14 Feb 2003 14:06:48 -0000      1.32
***************
*** 52,55 ****
--- 52,77 ----
  }
  
+ /* 
+  * append entries in the oldList to the collectedList to order
+  * the user specified static ctors after the ones from field decl
+  */
+ static void AppendStaticCtor(ILNode_List *collectedList, 
+                                                        ILNode_List *oldList)
+ {
+       ILNode_ListIter iter;
+       ILNode *curr;
+ 
+       if(!oldList)return;
+ 
+       if (yyisa(oldList, ILNode_List))
+       {
+               ILNode_ListIter_Init(&iter,oldList);
+               while((curr = ILNode_ListIter_Next(&iter)))
+               {
+                       ILNode_List_Add(collectedList,curr);
+               }
+       }
+ }
+ 
  %}
  
***************
*** 66,69 ****
--- 88,92 ----
        ILNode *savedNamespace;
        ILNode *savedMethod;
+       ILNode *staticCtorList=NULL;
        int hadStaticCtorsBefore;
        int target;
***************
*** 144,156 ****
                }
  
!               /*  Create static constructor method if necessary  */
!               if (!node->staticCtors)
                {
!                       node->staticCtors = ILNode_List_create();
                }
  
                ILNode_Declaration_GatherStaticCtor
                                                                (   
(ILNode_Declaration *)node->body, 
                                                                        
(ILNode_List *)node->staticCtors);
  
                if (ILNode_List_Length(node->staticCtors) == 0)
--- 167,188 ----
                }
  
!               /*  save the explicit static constructors before gathering  */
!               if (node->staticCtors)
                {
!                       staticCtorList=node->staticCtors;
                }
  
+               node->staticCtors=ILNode_List_create();
+ 
                ILNode_Declaration_GatherStaticCtor
                                                                (   
(ILNode_Declaration *)node->body, 
                                                                        
(ILNode_List *)node->staticCtors);
+ 
+               /* append the explicit static constructors to the end of the 
+                  gathered list */
+               AppendStaticCtor((ILNode_List*)node->staticCtors,
+                                                 (ILNode_List*) 
staticCtorList);
+ 
+               staticCtorList=NULL; /* do not use it again or segfault :-) */
  
                if (ILNode_List_Length(node->staticCtors) == 0)





reply via email to

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