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_grammar.y profile...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog cscc/csharp/cs_grammar.y profile...
Date: Mon, 12 Mar 2007 20:37:41 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      07/03/12 20:37:41

Modified files:
        .              : ChangeLog 
        cscc/csharp    : cs_grammar.y 
        profiles       : compact compact-fp full full-tl kernel 
                         kernel-fp tiny 

Log message:
        2007-03-12  Klaus Treichel  <address@hidden>
        
                * cscc/csharp/cs_grammar.y: Add support for static classes.
        
                * profiles/compact, profiles/compact-fp, profiles/full, 
profiles/full-tl,
                profiles/kernel, profiles/kernel-fp, profiles/tiny: Add 
IL_VERSION_MAJOR
                and IL_VERSION_MINOR for the framework version that should be 
supported.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3434&r2=1.3435
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_grammar.y?cvsroot=dotgnu-pnet&r1=1.75&r2=1.76
http://cvs.savannah.gnu.org/viewcvs/pnet/profiles/compact?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/profiles/compact-fp?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/profiles/full?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/profiles/full-tl?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnet/profiles/kernel?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/profiles/kernel-fp?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/profiles/tiny?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3434
retrieving revision 1.3435
diff -u -b -r1.3434 -r1.3435
--- ChangeLog   10 Mar 2007 21:54:57 -0000      1.3434
+++ ChangeLog   12 Mar 2007 20:37:41 -0000      1.3435
@@ -1,3 +1,11 @@
+2007-03-12  Klaus Treichel  <address@hidden>
+
+       * cscc/csharp/cs_grammar.y: Add support for static classes.
+
+       * profiles/compact, profiles/compact-fp, profiles/full, 
profiles/full-tl,
+       profiles/kernel, profiles/kernel-fp, profiles/tiny: Add IL_VERSION_MAJOR
+       and IL_VERSION_MINOR for the framework version that should be supported.
+
 2007-03-10  Radek Polak  <address@hidden>
 
        * pnet/engine/cvmc.c, pnet/engine/cvmc_setup.c,

Index: cscc/csharp/cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- cscc/csharp/cs_grammar.y    28 Oct 2004 14:19:10 -0000      1.75
+++ cscc/csharp/cs_grammar.y    12 Mar 2007 20:37:41 -0000      1.76
@@ -271,13 +271,14 @@
  */
 static ILNode **classNameStack = 0;
 static int     *classNameCtorDefined = 0;
+static ILUInt32 *classNameModifiers = 0;
 static int             classNameStackSize = 0;
 static int             classNameStackMax = 0;
 
 /*
  * Push an item onto the class name stack.
  */
-static void ClassNamePush(ILNode *name)
+static void ClassNamePush(ILNode *name, ILUInt32 modifiers)
 {
        if(classNameStackSize >= classNameStackMax)
        {
@@ -293,9 +294,16 @@
                {
                        CCOutOfMemory();
                }
+               classNameModifiers = (ILUInt32 *)ILRealloc
+                       (classNameModifiers, sizeof(ILUInt32) * 
(classNameStackMax + 4));
+               if(!classNameModifiers)
+               {
+                       CCOutOfMemory();
+               }
                classNameStackMax += 4;
        }
        classNameStack[classNameStackSize] = name;
+       classNameModifiers[classNameStackSize] = modifiers;
        classNameCtorDefined[classNameStackSize++] = 0;
 }
 
@@ -324,6 +332,14 @@
 }
 
 /*
+ * Get the modifiers of the current class.
+ */
+static ILUInt32 ClassNameGetModifiers(void)
+{
+       return classNameModifiers[classNameStackSize - 1];
+}
+
+/*
  * Determine if an identifier is identical to
  * the top of the class name stack.
  */
@@ -2719,21 +2735,54 @@
                                /* Enter a new nesting level */
                                ++NestingLevel;
 
+                       #if IL_VERSION_MAJOR > 1
+                               /* ECMA 334 Version 4: 17.1.1.3 */
+                               if($2 & CS_MODIFIER_STATIC)
+                               {
+                                       if($2 & CS_MODIFIER_SEALED)
+                                       {
+                                               CCError(_("static classes must 
not be sealed"));
+                                       }
+                                       if($2 & CS_MODIFIER_ABSTRACT)
+                                       {
+                                               CCError(_("static classes must 
not be abstract"));
+                                       }
+                                       if($7 != 0)
+                                       {
+                                               CCError(_("static classes must 
not have a base class specification"));
+                                       }
+                                       /* Static classes are implecitely 
sealed. */
+                                       /* ECMA 335 Version 4: 10.1.4 states 
they should be abstract too. */
+                                       $2 |= (CS_MODIFIER_SEALED | 
CS_MODIFIER_ABSTRACT);
+                               }
+                       #endif  /* IL_VERSION_MAJOR > 1 */
+
                                /* Push the identifier onto the class name 
stack */
-                               ClassNamePush($5);
+                               ClassNamePush($5, $2);
                        }
                        ClassBody OptSemiColon  {
                                ILNode *classBody = ($10).body;
 
                                /* Validate the modifiers */
                                ILUInt32 attrs =
+                       #if IL_VERSION_MAJOR > 1
+                                       CSModifiersToTypeAttrs($5, $2 & 
~CS_MODIFIER_STATIC,
+                                                                               
   (NestingLevel > 1));
+                       #else   /* IL_VERSION_MAJOR == 1 */
                                        CSModifiersToTypeAttrs($5, $2, 
(NestingLevel > 1));
+                       #endif  /* IL_VERSION_MAJOR == 1 */
 
                                /* Exit the current nesting level */
                                --NestingLevel;
 
                                /* Determine if we need to add a default 
constructor */
+                       #if IL_VERSION_MAJOR > 1
+                               /* Don't add the default constructor for static 
classes. */
+                               if((($2 & CS_MODIFIER_STATIC) == 0) && 
+                                  !ClassNameIsCtorDefined())
+                       #else   /* IL_VERSION_MAJOR == 1 */
                                if(!ClassNameIsCtorDefined())
+                       #endif  /* IL_VERSION_MAJOR == 1 */
                                {
                                        ILUInt32 ctorMods =
                                                (((attrs & 
IL_META_TYPEDEF_ABSTRACT) != 0)
@@ -2835,7 +2884,7 @@
 
                                /* Push the identifier onto the class name 
stack */
                                $<node>$ = ILQualIdentSimple("<Module>");
-                               ClassNamePush($<node>$);
+                               ClassNamePush($<node>$, 0);
                        }
                        ClassBody OptSemiColon  {
                                ILNode *classBody = ($3).body;
@@ -2962,6 +3011,19 @@
 FieldDeclaration
        : OptAttributes OptModifiers Type FieldDeclarators ';'  {
                                ILUInt32 attrs = CSModifiersToFieldAttrs($3, 
$2);
+                       #if IL_VERSION_MAJOR > 1
+                               if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
+                               {
+                                       if(!($2 & CS_MODIFIER_STATIC))
+                                       {
+                                               CCError(_("only static fields 
are allowed in static classes"));
+                                       }
+                                       if($2 & CS_MODIFIER_PROTECTED)
+                                       {
+                                               CCError(_("no protected or 
protected internal fields are allowed in static classes"));
+                                       }
+                               }
+                       #endif  /* IL_VERSION_MAJOR > 1 */
                                $$ = ILNode_FieldDeclaration_create($1, attrs, 
$3, $4);
                        }
        ;
@@ -3001,6 +3063,19 @@
                                        CCErrorOnLine(yygetfilename($3), 
yygetlinenum($3),
                                                "`private' cannot be used in 
this context");
                                }
+                       #if IL_VERSION_MAJOR > 1
+                               if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
+                               {
+                                       if(!($2 & CS_MODIFIER_STATIC))
+                                       {
+                                               CCError(_("only static methods 
are allowed in static classes"));
+                                       }
+                                       if($2 & CS_MODIFIER_PROTECTED)
+                                       {
+                                               CCError(_("no protected or 
protected internal methods are allowed in static classes"));
+                                       }
+                               }
+                       #endif  /* IL_VERSION_MAJOR > 1 */
                                $$ = ILNode_MethodDeclaration_create
                                                ($1, attrs, $3, $4, $6, $8);
                                CloneLine($$, $4);
@@ -3053,6 +3128,19 @@
                        StartAccessorBlock AccessorBlock        {
                                ILUInt32 attrs;
 
+                       #if IL_VERSION_MAJOR > 1
+                               if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
+                               {
+                                       if(!($2 & CS_MODIFIER_STATIC))
+                                       {
+                                               CCError(_("only static 
properties are allowed in static classes"));
+                                       }
+                                       if($2 & CS_MODIFIER_PROTECTED)
+                                       {
+                                               CCError(_("no protected or 
protected internal properties are allowed in static classes"));
+                                       }
+                               }
+                       #endif  /* IL_VERSION_MAJOR > 1 */
                                /* Create the property declaration */
                                attrs = CSModifiersToPropertyAttrs($3, $2);
                                $$ = ILNode_PropertyDeclaration_create($1,
@@ -3142,6 +3230,19 @@
 EventFieldDeclaration
        : OptAttributes OptModifiers EVENT Type EventDeclarators ';'    {
                                ILUInt32 attrs = CSModifiersToEventAttrs($4, 
$2);
+                       #if IL_VERSION_MAJOR > 1
+                               if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
+                               {
+                                       if(!($2 & CS_MODIFIER_STATIC))
+                                       {
+                                               CCError(_("only static events 
are allowed in static classes"));
+                                       }
+                                       if($2 & CS_MODIFIER_PROTECTED)
+                                       {
+                                               CCError(_("no protected or 
protected internal events are allowed in static classes"));
+                                       }
+                               }
+                       #endif  /* IL_VERSION_MAJOR > 1 */
                                $$ = ILNode_EventDeclaration_create($1, attrs, 
$4, $5);
                                CreateEventMethods((ILNode_EventDeclaration 
*)($$));
                        }
@@ -3239,6 +3340,21 @@
                                ILNode* 
name=GetIndexerName(&CCCodeGen,(ILNode_AttributeTree*)$1,
                                                        $3.ident);
                                ILUInt32 attrs = 
CSModifiersToPropertyAttrs($3.type, $2);
+
+                       #if IL_VERSION_MAJOR > 1
+                               if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
+                               {
+                                       if(!($2 & CS_MODIFIER_STATIC))
+                                       {
+                                               CCError(_("only static indexers 
are allowed in static classes"));
+                                       }
+                                       if($2 & CS_MODIFIER_PROTECTED)
+                                       {
+                                               CCError(_("no protected or 
protected internal indexers are allowed in static classes"));
+                                       }
+                               }
+                       #endif  /* IL_VERSION_MAJOR > 1 */
+
                                $$ = ILNode_PropertyDeclaration_create($1,
                                                                   attrs, 
$3.type, name, $3.params,
                                                                   $5.item1, 
$5.item2,
@@ -3319,6 +3435,13 @@
                                        $5.unary = $5.binary;
                                }
 
+                       #if IL_VERSION_MAJOR > 1
+                               if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
+                               {
+                                       CCError(_("no operators are allowed in 
static classes"));
+                               }
+                       #endif  /* IL_VERSION_MAJOR > 1 */
+
                                /* Get the operator attributes */
                                attrs = CSModifiersToOperatorAttrs($3, $2);
 
@@ -3348,6 +3471,13 @@
                                        $5.binary = $5.unary;
                                }
 
+                       #if IL_VERSION_MAJOR > 1
+                               if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
+                               {
+                                       CCError(_("no operators are allowed in 
static classes"));
+                               }
+                       #endif  /* IL_VERSION_MAJOR > 1 */
+
                                /* Get the operator attributes */
                                attrs = CSModifiersToOperatorAttrs($3, $2);
 
@@ -3456,6 +3586,17 @@
                                ILNode *cname;
                                ILNode *initializer = $7;
                                ILNode *body;
+
+                       #if IL_VERSION_MAJOR > 1
+                               if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
+                               {
+                                       if(!($2 & CS_MODIFIER_STATIC))
+                                       {
+                                               CCError(_("no instance 
constructors are allowed in static classes"));
+                                       }
+                               }
+                       #endif  /* IL_VERSION_MAJOR > 1 */
+
                                if((attrs & IL_META_METHODDEF_STATIC) != 0)
                                {
                                        cname = ILQualIdentSimple
@@ -3546,6 +3687,16 @@
                                ILNode *name;
                                ILNode *body;
 
+                       #if IL_VERSION_MAJOR > 1
+                               if(ClassNameGetModifiers() & CS_MODIFIER_STATIC)
+                               {
+                                       if(!($2 & CS_MODIFIER_STATIC))
+                                       {
+                                               CCError(_("no destructors are 
allowed in static classes"));
+                                       }
+                               }
+                       #endif  /* IL_VERSION_MAJOR > 1 */
+
                                /* Destructors cannot have type parameters */
                                dtorName = $4;
                                if(yyisa(dtorName, ILNode_GenericReference))
@@ -3601,7 +3752,7 @@
                                ++NestingLevel;
 
                                /* Push the identifier onto the class name 
stack */
-                               ClassNamePush($5);
+                               ClassNamePush($5, $2);
                        }
                        StructBody OptSemiColon {
                                ILNode *baseList;
@@ -3675,7 +3826,7 @@
                                ++NestingLevel;
 
                                /* Push the identifier onto the class name 
stack */
-                               ClassNamePush($5);
+                               ClassNamePush($5, $2);
                        }
                        InterfaceBody OptSemiColon      {
                                /* Validate the modifiers */
@@ -3861,7 +4012,7 @@
                                ++NestingLevel;
 
                                /* Push the identifier onto the class name 
stack */
-                               ClassNamePush($4);
+                               ClassNamePush($4, $2);
                        }
                        EnumBody OptSemiColon   {
                                ILNode *baseList;

Index: profiles/compact
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/profiles/compact,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- profiles/compact    23 Jan 2007 19:49:02 -0000      1.8
+++ profiles/compact    12 Mar 2007 20:37:41 -0000      1.9
@@ -104,3 +104,9 @@
 # ECMA compliance. Might differ from observed behavior of .NET (y/n).
 IL_CONFIG_ECMA=y
 
+# Major CLR/Framework Version to support (1 .. 3)
+IL_VERSION_MAJOR=3
+
+# Minor CLR/Framework Version to support
+IL_VERSION_MINOR=0
+

Index: profiles/compact-fp
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/profiles/compact-fp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- profiles/compact-fp 23 Jan 2007 19:49:02 -0000      1.8
+++ profiles/compact-fp 12 Mar 2007 20:37:41 -0000      1.9
@@ -103,3 +103,9 @@
 # ECMA compliance. Might differ from observed behavior of .NET (y/n).
 IL_CONFIG_ECMA=y
 
+# Major CLR/Framework Version to support (1 .. 3)
+IL_VERSION_MAJOR=3
+
+# Minor CLR/Framework Version to support
+IL_VERSION_MINOR=0
+

Index: profiles/full
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/profiles/full,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- profiles/full       23 Jan 2007 19:49:02 -0000      1.8
+++ profiles/full       12 Mar 2007 20:37:41 -0000      1.9
@@ -103,3 +103,9 @@
 # ECMA compliance. Might differ from observed behavior of .NET (y/n).
 IL_CONFIG_ECMA=y
 
+# Major CLR/Framework Version to support (1 .. 3)
+IL_VERSION_MAJOR=3
+
+# Minor CLR/Framework Version to support
+IL_VERSION_MINOR=0
+

Index: profiles/full-tl
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/profiles/full-tl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- profiles/full-tl    23 Jan 2007 19:49:02 -0000      1.3
+++ profiles/full-tl    12 Mar 2007 20:37:41 -0000      1.4
@@ -103,3 +103,9 @@
 # ECMA compliance. Might differ from observed behavior of .NET (y/n).
 IL_CONFIG_ECMA=y
 
+# Major CLR/Framework Version to support (1 .. 3)
+IL_VERSION_MAJOR=3
+
+# Minor CLR/Framework Version to support
+IL_VERSION_MINOR=0
+

Index: profiles/kernel
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/profiles/kernel,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- profiles/kernel     23 Jan 2007 19:49:02 -0000      1.8
+++ profiles/kernel     12 Mar 2007 20:37:41 -0000      1.9
@@ -103,3 +103,9 @@
 # ECMA compliance. Might differ from observed behavior of .NET (y/n).
 IL_CONFIG_ECMA=y
 
+# Major CLR/Framework Version to support (1 .. 3)
+IL_VERSION_MAJOR=3
+
+# Minor CLR/Framework Version to support
+IL_VERSION_MINOR=0
+

Index: profiles/kernel-fp
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/profiles/kernel-fp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- profiles/kernel-fp  23 Jan 2007 19:49:02 -0000      1.8
+++ profiles/kernel-fp  12 Mar 2007 20:37:41 -0000      1.9
@@ -103,3 +103,9 @@
 # ECMA compliance. Might differ from observed behavior of .NET (y/n).
 IL_CONFIG_ECMA=y
 
+# Major CLR/Framework Version to support (1 .. 3)
+IL_VERSION_MAJOR=3
+
+# Minor CLR/Framework Version to support
+IL_VERSION_MINOR=0
+

Index: profiles/tiny
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/profiles/tiny,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- profiles/tiny       23 Jan 2007 19:49:02 -0000      1.4
+++ profiles/tiny       12 Mar 2007 20:37:41 -0000      1.5
@@ -100,3 +100,9 @@
 # ECMA compliance. Might differ from observed behavior of .NET (y/n).
 IL_CONFIG_ECMA=y
 
+# Major CLR/Framework Version to support (1 .. 3)
+IL_VERSION_MAJOR=3
+
+# Minor CLR/Framework Version to support
+IL_VERSION_MINOR=0
+




reply via email to

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