[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_stmt.tc,1.23,1.24
From: |
Gopal.V <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_stmt.tc,1.23,1.24 |
Date: |
Fri, 08 Nov 2002 05:32:28 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/cscc/csharp
In directory subversions:/tmp/cvs-serv26587/cscc/csharp
Modified Files:
cs_stmt.tc
Log Message:
allow foreach even if it does not implement IEnumerable
Index: cs_stmt.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_stmt.tc,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** cs_stmt.tc 27 Oct 2002 14:41:04 -0000 1.23
--- cs_stmt.tc 8 Nov 2002 10:32:25 -0000 1.24
***************
*** 338,349 ****
node->varType);
}
! else if(!ILFindNonSystemType(info,"IEnumerable","System.Collections"))
! {
! //prevent SEGFAULT during -nostdlib compile !
! CCErrorOnLine(yygetfilename(node), yygetlinenum(node),
! "Cannot find System.Collections.IEnumerable");
! }
! else if(ILTypeImplements(info, node->arrayType,
!
ILFindNonSystemType(info,"IEnumerable","System.Collections")))
{
arrayClass = ILTypeToClass(info, node->arrayType);
--- 338,342 ----
node->varType);
}
! else
{
arrayClass = ILTypeToClass(info, node->arrayType);
***************
*** 355,370 ****
(ILType**)args, 0);
}
! else
{
! getEnumerator = 0;
! }
! if(!getEnumerator)
{
- //should I check IEnumerable.GetEnumerator ?
CCErrorOnLine(yygetfilename(node), yygetlinenum(node),
! "'%s' does not have a
'GetEnumerator' available",
!
CSTypeToName(node->arrayType));
}
! else
{
enumerator=ILTypeGetReturn(ILMethod_Signature(getEnumerator));
--- 348,367 ----
(ILType**)args, 0);
}
! else if(ILTypeImplements(info, node->arrayType,
!
ILFindNonSystemType(info,"IEnumerable","System.Collections")))
{
! getEnumerator = ILResolveInstanceMethod(info,
arrayClass,
!
GetDefaultScope(info),
!
"IEnumerable.GetEnumerator",
!
(ILType**)args, 0);
! }
! else
{
CCErrorOnLine(yygetfilename(node), yygetlinenum(node),
! "'%s' does not have a 'GetEnumerator' or
'IEnumerable.GetEnumerator'"
! ,CSTypeToName(node->arrayType));
! getEnumerator = 0;
}
! if(getEnumerator)
{
enumerator=ILTypeGetReturn(ILMethod_Signature(getEnumerator));
***************
*** 373,376 ****
--- 370,381 ----
GetDefaultScope(info),
"Current");
+ if(!property)
+ {
+ property=ILResolveProperty(info,
+
ILType_ToClass(enumerator),
+ GetDefaultScope(info),
+ "IEnumerator.Current");
+ }
+
getCurrent=(property ? ILProperty_Getter(property) : 0);
moveNext=ILResolveInstanceMethod(info,
***************
*** 380,387 ****
(ILType**)args,
0);
! if(!getCurrent)
{
CCErrorOnLine(yygetfilename(node),
yygetlinenum(node),
! "Cannot locate Current property in
'%s'",
CSTypeToName(enumerator));
}
--- 385,407 ----
(ILType**)args,
0);
! if(!moveNext)
! {
! moveNext=ILResolveInstanceMethod(info,
! ILType_ToClass(enumerator),
! GetDefaultScope(info),
! "IEnumerator.MoveNext",
! (ILType**)args,
! 0);
! }
! if(!property)
{
CCErrorOnLine(yygetfilename(node),
yygetlinenum(node),
! "Cannot locate 'Current' or 'IEnumerator.Current' property in
'%s'",
! CSTypeToName(enumerator));
! }
! else if(!getCurrent)
! {
! CCErrorOnLine(yygetfilename(node),
yygetlinenum(node),
! "'Current' property has no 'get' method in
'%s'",
CSTypeToName(enumerator));
}
***************
*** 389,393 ****
{
CCErrorOnLine(yygetfilename(node),
yygetlinenum(node),
! "Cannot locate MoveNext() in '%s'",
CSTypeToName(enumerator));
}
--- 409,413 ----
{
CCErrorOnLine(yygetfilename(node),
yygetlinenum(node),
! "Cannot locate 'MoveNext()' or
'IEnumerator.MoveNext()' in '%s'",
CSTypeToName(enumerator));
}
***************
*** 435,444 ****
}
}
- else
- {
- CCErrorOnLine(yygetfilename(node), yygetlinenum(node),
- "'%s' does not implement
IEnumerable",CSTypeToName(node->arrayType));
- }
-
/* Done */
return CSSemValueDefault;
--- 455,458 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_stmt.tc,1.23,1.24,
Gopal.V <address@hidden> <=