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

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

[dotgnu-pnet-commits] pnet ChangeLog cscc/csharp/cs_decls.tc


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog cscc/csharp/cs_decls.tc
Date: Fri, 28 Jul 2006 17:12:21 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      06/07/28 17:12:21

Modified files:
        .              : ChangeLog 
        cscc/csharp    : cs_decls.tc 

Log message:
        2006-07-28  Kaushik Srenevasan  <address@hidden>
        
                * cscc/csharp/cs_decls.tc: Disallow explicit parameterless 
constructors
                for structs. (Patch #4800). Disallow initializers for non 
static members
                in structs. (Patch #4812)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3344&r2=1.3345
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_decls.tc?cvsroot=dotgnu-pnet&r1=1.40&r2=1.41

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3344
retrieving revision 1.3345
diff -u -b -r1.3344 -r1.3345
--- ChangeLog   22 Jul 2006 08:48:32 -0000      1.3344
+++ ChangeLog   28 Jul 2006 17:12:20 -0000      1.3345
@@ -1,3 +1,9 @@
+2006-07-28  Kaushik Srenevasan  <address@hidden>
+
+       * cscc/csharp/cs_decls.tc: Disallow explicit parameterless constructors
+       for structs. (Patch #4800). Disallow initializers for non static members
+       in structs. (Patch #4812)
+
 2006-07-22  Kirill Kononenko  <address@hidden>
 
        * engine/jitc.c: Add additional signatures needed for pinvokes.

Index: cscc/csharp/cs_decls.tc
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/cscc/csharp/cs_decls.tc,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- cscc/csharp/cs_decls.tc     7 Jul 2004 23:47:37 -0000       1.40
+++ cscc/csharp/cs_decls.tc     28 Jul 2006 17:12:20 -0000      1.41
@@ -763,6 +763,18 @@
        /* Non-static fields are initialized differently */
        if(node->owner && (node->owner->modifiers & IL_META_FIELDDEF_STATIC) == 
0)
        {
+               /* non-static field initializers are not allowed in structs */  
 
+               if(ILClassIsValueType(((ILNode_ClassDefn 
*)info->currentClass)->classInfo))
+               {
+                       if (node->initializer != NULL)
+                       {
+                               CCErrorOnLine(yygetfilename(node), 
yygetlinenum(node), 
+                                                       "Structs cannot have 
instance field initializers");
+
+                               return CSSemValueDefault;
+                       }
+               }
+
                initializer = ILNode_Assign_create(node->name, 
node->initializer);
                yysetfilename(initializer,yygetfilename(node));
                yysetlinenum(initializer,yygetlinenum(node));
@@ -943,6 +955,20 @@
        {
                CSProcessAttrs(info, ILToProgramItem(node->methodInfo),
                                           node->attributes, 
CS_ATTR_CONSTRUCTOR);
+
+               if (ILClassIsValueType(((ILNode_ClassDefn 
*)info->currentClass)->classInfo)
+                                                                               
&& ILMethod_IsConstructor(node->methodInfo))
+               {
+                       int numParams = 
ILTypeNumParams(ILMethod_Signature(ILToProgramItem(node->methodInfo)));
+
+                       if(numParams == 0)
+                       {
+                               CCErrorOnLine(yygetfilename(node), 
yygetlinenum(node),
+                                               "Structs cannot contain 
explicit parameterless constructors");
+
+                               return CSSemValueDefault;
+                       }
+               }
        }
        else
        {




reply via email to

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