[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnet/cscc/csharp cs_grammar.y, 1.68, 1.69 cs_invok
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnet/cscc/csharp cs_grammar.y, 1.68, 1.69 cs_invoke.tc, 1.27, 1.28 |
Date: |
Fri, 07 Nov 2003 01:23:58 +0000 |
Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv11660/cscc/csharp
Modified Files:
cs_grammar.y cs_invoke.tc
Log Message:
Add some semantic analysis for "new X<T>(...)" expression forms.
Index: cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -d -r1.68 -r1.69
*** cs_grammar.y 7 Nov 2003 00:12:36 -0000 1.68
--- cs_grammar.y 7 Nov 2003 01:23:55 -0000 1.69
***************
*** 1495,1502 ****
| DELEGATE AnonymousMethod { $$ = $2; }
| PrimaryExpression '.' DEFAULT {
! $$ = ILNode_DefaultConstructor_create($1, 0);
}
| BuiltinType '.' DEFAULT {
! $$ = ILNode_DefaultConstructor_create($1, 0);
}
;
--- 1495,1502 ----
| DELEGATE AnonymousMethod { $$ = $2; }
| PrimaryExpression '.' DEFAULT {
! $$ = ILNode_DefaultConstructor_create($1, 0, 0);
}
| BuiltinType '.' DEFAULT {
! $$ = ILNode_DefaultConstructor_create($1, 0, 0);
}
;
Index: cs_invoke.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_invoke.tc,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** cs_invoke.tc 7 Nov 2003 00:12:36 -0000 1.27
--- cs_invoke.tc 7 Nov 2003 01:23:55 -0000 1.28
***************
*** 675,678 ****
--- 675,679 ----
ILMethod *methodInfo;
ILType *objectType;
+ ILType *mainType;
ILClass *objectClass;
CSEvalArg *args;
***************
*** 687,690 ****
--- 688,701 ----
CSSemSetRValue(value, objectType);
+ /* Get the main type, after stripping "with" parameters */
+ if(ILType_IsWith(objectType))
+ {
+ mainType = ILTypeGetWithMain(objectType);
+ }
+ else
+ {
+ mainType = objectType;
+ }
+
/* The type must be a delegate, a non-abstract class, or a value type */
if(ILTypeIsDelegate(objectType))
***************
*** 712,718 ****
node->argList, parent);
}
! else if(ILType_IsClass(objectType))
{
! objectClass = ILClassResolve(ILType_ToClass(objectType));
if(ILClass_IsInterface(objectClass))
{
--- 723,729 ----
node->argList, parent);
}
! else if(ILType_IsClass(mainType))
{
! objectClass = ILClassResolve(ILType_ToClass(mainType));
if(ILClass_IsInterface(objectClass))
{
***************
*** 730,734 ****
}
}
! else if(ILTypeIsValue(objectType))
{
/* Check for the default constructor case */
--- 741,745 ----
}
}
! else if(ILTypeIsValue(mainType))
{
/* Check for the default constructor case */
***************
*** 736,744 ****
{
/* Replace this node with a default constructor call */
! *parent = ILNode_DefaultConstructor_create(0,
objectType);
yysetfilename(*parent, yygetfilename(node));
yysetlinenum(*parent, yygetlinenum(node));
return value;
}
}
else
--- 747,771 ----
{
/* Replace this node with a default constructor call */
! *parent = ILNode_DefaultConstructor_create(0,
objectType, 0);
yysetfilename(*parent, yygetfilename(node));
yysetlinenum(*parent, yygetlinenum(node));
return value;
}
+ }
+ else if(ILType_IsTypeParameter(objectType) ||
+ ILType_IsMethodParameter(objectType))
+ {
+ /* Can only use zero-argument constructors with generic
parameters */
+ if(node->argList)
+ {
+ CCErrorOnLine(yygetfilename(node->type),
yygetlinenum(node->type),
+ "`%s' cannot be constructed
with arguments",
+ CSTypeToName(objectType));
+ return value;
+ }
+ *parent = ILNode_DefaultConstructor_create(0, objectType, 1);
+ yysetfilename(*parent, yygetfilename(node));
+ yysetlinenum(*parent, yygetlinenum(node));
+ return value;
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnet/cscc/csharp cs_grammar.y, 1.68, 1.69 cs_invoke.tc, 1.27, 1.28,
Rhys Weatherley <address@hidden> <=