[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.52,1.53
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.52,1.53 |
Date: |
Sat, 22 Feb 2003 02:22:02 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv23007/cscc/csharp
Modified Files:
cs_grammar.y
Log Message:
Attach the type formals to the ILNode_ClassDefn node; print an error if type
formals are used on a constructor or destructor.
Index: cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -r1.52 -r1.53
*** cs_grammar.y 22 Feb 2003 06:14:33 -0000 1.52
--- cs_grammar.y 22 Feb 2003 07:21:59 -0000 1.53
***************
*** 909,918 ****
%type <node> OptArrayInitializer ArrayInitializer
%type <node> OptVariableInitializerList VariableInitializerList
! %type <node> TypeActuals
%type <indexer> IndexerDeclarator
%type <catchinfo> CatchNameInfo
%type <target> AttributeTarget
! %expect 26
%start CompilationUnit
--- 909,918 ----
%type <node> OptArrayInitializer ArrayInitializer
%type <node> OptVariableInitializerList VariableInitializerList
! %type <node> TypeActuals TypeFormals TypeFormalList
%type <indexer> IndexerDeclarator
%type <catchinfo> CatchNameInfo
%type <target> AttributeTarget
! %expect 25
%start CompilationUnit
***************
*** 2623,2626 ****
--- 2623,2627 ----
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
+ $5,
/* TypeFormals */
$6,
/* ClassBase */
classBody,
***************
*** 2636,2648 ****
;
- /* TODO: generic formal parameter list */
TypeFormals
! : /* empty */
! | '<' TypeFormalList '>'
;
TypeFormalList
! : Identifier { /* TODO */ }
! | TypeFormalList ',' Identifier { /* TODO */ }
;
--- 2637,2654 ----
;
TypeFormals
! : /* empty */ { $$ = 0; }
! | '<' TypeFormalList '>' { $$ = $2; }
;
TypeFormalList
! : Identifier {
! $$ = ILNode_List_create();
! ILNode_List_Add($$, $1);
! }
! | TypeFormalList ',' Identifier {
! ILNode_List_Add($1, $3);
! $$ = $1;
! }
;
***************
*** 2689,2692 ****
--- 2695,2699 ----
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
+ 0,
/* TypeFormals */
0,
/* ClassBase */
classBody,
***************
*** 3281,3287 ****
ConstructorDeclaration
! : OptAttributes OptModifiers Identifier '(' OptFormalParameterList ')'
! ConstructorInitializer MethodBody {
ILUInt32 attrs =
CSModifiersToConstructorAttrs($3, $2);
ILNode *cname;
ILNode *initializer = $7;
--- 3288,3295 ----
ConstructorDeclaration
! : OptAttributes OptModifiers QualifiedIdentifierPart
! '(' OptFormalParameterList ')' ConstructorInitializer
MethodBody {
ILUInt32 attrs =
CSModifiersToConstructorAttrs($3, $2);
+ ILNode *ctorName;
ILNode *cname;
ILNode *initializer = $7;
***************
*** 3299,3303 ****
ClassNameCtorDefined();
}
! if(!ClassNameSame($3))
{
CCErrorOnLine(yygetfilename($3),
yygetlinenum($3),
--- 3307,3318 ----
ClassNameCtorDefined();
}
! ctorName = $3;
! if(yyisa(ctorName, ILNode_GenericReference))
! {
! CCErrorOnLine(yygetfilename($3),
yygetlinenum($3),
! "constructors cannot have type
parameters");
! ctorName = ((ILNode_GenericReference
*)ctorName)->type;
! }
! if(!ClassNameSame(ctorName))
{
CCErrorOnLine(yygetfilename($3),
yygetlinenum($3),
***************
*** 3317,3321 ****
body = ILNode_NewScope_create
(ILNode_Compound_CreateFrom(initializer, $8));
!
CCWarningOnLine(yygetfilename($3),yygetlinenum($3),
"constructor without body
should be declared 'extern'");
}
--- 3332,3336 ----
body = ILNode_NewScope_create
(ILNode_Compound_CreateFrom(initializer, $8));
! CCWarningOnLine(yygetfilename($3),
yygetlinenum($3),
"constructor without body
should be declared 'extern'");
}
***************
*** 3359,3369 ****
DestructorDeclaration
! : OptAttributes '~' Identifier '(' ')' Block {
ILUInt32 attrs;
ILNode *name;
ILNode *body;
/* Validate the destructor name */
! if(!ClassNameSame($3))
{
CCErrorOnLine(yygetfilename($3),
yygetlinenum($3),
--- 3374,3394 ----
DestructorDeclaration
! : OptAttributes '~' QualifiedIdentifierPart '(' ')' Block
{
ILUInt32 attrs;
+ ILNode *dtorName;
ILNode *name;
ILNode *body;
+ /* 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;
+ }
+
/* Validate the destructor name */
! if(!ClassNameSame(dtorName))
{
CCErrorOnLine(yygetfilename($3),
yygetlinenum($3),
***************
*** 3445,3448 ****
--- 3470,3474 ----
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
+ $5,
/* TypeFormals */
baseList,
/* ClassBase */
($9).body,
/* StructBody */
***************
*** 3508,3511 ****
--- 3534,3538 ----
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
+ $5,
/* TypeFormals */
$6,
/* ClassBase */
$9,
/* InterfaceBody */
***************
*** 3720,3723 ****
--- 3747,3751 ----
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
+ 0,
/* TypeFormals */
baseList,
/* ClassBase */
bodyList,
/* EnumBody */
***************
*** 3821,3824 ****
--- 3849,3853 ----
CurrNamespace.string,
/* Namespace */
(ILNode
*)CurrNamespaceNode,
+ $6,
/* TypeFormals */
baseList,
/* ClassBase */
bodyList,
/* Body */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.52,1.53,
Rhys Weatherley <address@hidden> <=