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_grammar.y,1.62,1.63 cs_in


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.62,1.63 cs_internal.h,1.17,1.18 cs_modifiers.c,1.5,1.6
Date: Sat, 14 Jun 2003 15:24:44 -0400

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

Modified Files:
        cs_grammar.y cs_internal.h cs_modifiers.c 
Log Message:
allow unsafe destructors


Index: cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -r1.62 -r1.63
*** cs_grammar.y        11 Jun 2003 19:04:48 -0000      1.62
--- cs_grammar.y        14 Jun 2003 19:24:42 -0000      1.63
***************
*** 3455,3459 ****
  
  DestructorDeclaration
!       : OptAttributes '~' QualifiedIdentifierPart '(' ')' Block               
{
                                ILUInt32 attrs;
                                ILNode *dtorName;
--- 3455,3459 ----
  
  DestructorDeclaration
!       : OptAttributes OptModifiers '~' QualifiedIdentifierPart '(' ')' Block  
        {
                                ILUInt32 attrs;
                                ILNode *dtorName;
***************
*** 3462,3469 ****
  
                                /* Destructors cannot have type parameters */
!                               dtorName = $3;
                                if(yyisa(dtorName, ILNode_GenericReference))
                                {
!                                       CCErrorOnLine(yygetfilename($3), 
yygetlinenum($3),
                                                "destructors cannot have type 
parameters");
                                        dtorName = ((ILNode_GenericReference 
*)dtorName)->type;
--- 3462,3469 ----
  
                                /* Destructors cannot have type parameters */
!                               dtorName = $4;
                                if(yyisa(dtorName, ILNode_GenericReference))
                                {
!                                       CCErrorOnLine(yygetfilename($4), 
yygetlinenum($4),
                                                "destructors cannot have type 
parameters");
                                        dtorName = ((ILNode_GenericReference 
*)dtorName)->type;
***************
*** 3473,3485 ****
                                if(!ClassNameSame(dtorName))
                                {
!                                       CCErrorOnLine(yygetfilename($3), 
yygetlinenum($3),
                                                "destructor name does not match 
class name");
                                }
  
                                /* Build the list of attributes needed on 
"Finalize" */
!                               attrs = IL_META_METHODDEF_FAMILY |
!                                               IL_META_METHODDEF_HIDE_BY_SIG |
!                                               IL_META_METHODDEF_VIRTUAL |
!                                               CS_SPECIALATTR_OVERRIDE;
  
                                /* Build the name of the "Finalize" method */
--- 3473,3482 ----
                                if(!ClassNameSame(dtorName))
                                {
!                                       CCErrorOnLine(yygetfilename($4), 
yygetlinenum($4),
                                                "destructor name does not match 
class name");
                                }
  
                                /* Build the list of attributes needed on 
"Finalize" */
!                               attrs = CSModifiersToDestructorAttrs($4,$2);
  
                                /* Build the name of the "Finalize" method */
***************
*** 3496,3500 ****
                                                        
(ILNode_BaseAccess_create(name), 0));
                                body = ILNode_Try_create
!                                                       ($6, 0, 
ILNode_FinallyClause_create(body));
  
                                /* Construct the finalizer declaration */
--- 3493,3497 ----
                                                        
(ILNode_BaseAccess_create(name), 0));
                                body = ILNode_Try_create
!                                                       ($7, 0, 
ILNode_FinallyClause_create(body));
  
                                /* Construct the finalizer declaration */
***************
*** 3504,3508 ****
                                                                
(ILInternString("Finalize", -1).string),
                                                         0, body);
!                               CloneLine($$, $3);
                        }
        ;
--- 3501,3505 ----
                                                                
(ILInternString("Finalize", -1).string),
                                                         0, body);
!                               CloneLine($$, $4);
                        }
        ;

Index: cs_internal.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_internal.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** cs_internal.h       31 May 2003 12:30:32 -0000      1.17
--- cs_internal.h       14 Jun 2003 19:24:42 -0000      1.18
***************
*** 114,117 ****
--- 114,118 ----
  ILUInt32 CSModifiersToOperatorAttrs(ILNode *node, ILUInt32 modifiers);
  ILUInt32 CSModifiersToConstructorAttrs(ILNode *node, ILUInt32 modifiers);
+ ILUInt32 CSModifiersToDestructorAttrs(ILNode *node, ILUInt32 modifiers);
  
  /*

Index: cs_modifiers.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_modifiers.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** cs_modifiers.c      11 Dec 2002 17:56:14 -0000      1.5
--- cs_modifiers.c      14 Jun 2003 19:24:42 -0000      1.6
***************
*** 807,810 ****
--- 807,843 ----
  }
  
+ ILUInt32 CSModifiersToDestructorAttrs(ILNode *node, ILUInt32 modifiers)
+ {
+       ILUInt32 attrs=0;
+       
+       BadModifiers(node,
+                                       modifiers & ~(CS_MODIFIER_EXTERN |
+                                                             
CS_MODIFIER_UNSAFE));
+ 
+       /* Process the "unsafe" modifier */
+       if(modifiers == CS_MODIFIER_UNSAFE)
+       {
+               attrs = CS_SPECIALATTR_UNSAFE;
+       }
+       else if(modifiers == CS_MODIFIER_EXTERN)
+       {
+               attrs = CS_SPECIALATTR_EXTERN;
+       }
+       else if((modifiers & (CS_SPECIALATTR_EXTERN | 
CS_SPECIALATTR_EXTERN))!=0)
+       {
+               CCWarningOnLine(yygetfilename(node),yygetlinenum(node),
+                                                       "'extern' and 'unsafe' 
modifiers used together");
+       }
+ 
+       /* Add the "hidebysig" and "*specialname" attributes always */
+       attrs |= IL_META_METHODDEF_FAMILY |
+                        IL_META_METHODDEF_HIDE_BY_SIG |
+                        IL_META_METHODDEF_VIRTUAL |
+                        CS_SPECIALATTR_OVERRIDE;
+ 
+       /* Done */
+       return attrs;
+ }
+ 
  #ifdef        __cplusplus
  };





reply via email to

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