--- /opt/cvs/dotgnu/pnet/cscc/csharp/cs_stmt.tc Tue Aug 13 22:36:40 2002 +++ /tmp/dotgnu/pnet/cscc/csharp/cs_stmt.tc Sat Aug 31 12:47:38 2002 @@ -323,6 +323,17 @@ has the same type as the array elements. We can optimise this case in the code generator to scan the array efficiently */ } + else if(ILType_IsSimpleArray(node->arrayType)) + { + castNode=ILNode_EmptyExpr_create(node->varType); + if(!ILCast(info,castNode,&(castNode),node->elemType,type)) + { + CCErrorOnLine(yygetfilename(node), yygetlinenum(node), + "Cannot cast '%s' to '%s'",CSTypeToName(node->elemType), + CSTypeToName(type)); + } + node->doCast=castNode; + } else if(ILTypeIsStringClass(node->arrayType) && ILTypeIdentical(type, ILType_Char)) { --- /opt/cvs/dotgnu/pnet/codegen/cg_nodes.tc Fri Aug 23 16:11:09 2002 +++ /tmp/dotgnu/pnet/codegen/cg_nodes.tc Sat Aug 31 12:56:15 2002 @@ -629,6 +629,7 @@ ILNode *varNameNode; ILNode *expr; ILNode *stmt; + %nocreate ILNode* doCast = {0}; %nocreate unsigned long varIndex = {0}; %nocreate ILMachineType varType = {ILMachineType_Void}; %nocreate ILType *arrayType = {0}; --- /opt/cvs/dotgnu/pnet/codegen/cg_stmt.tc Fri Aug 23 16:11:10 2002 +++ /tmp/dotgnu/pnet/codegen/cg_stmt.tc Sat Aug 31 12:22:58 2002 @@ -712,6 +712,10 @@ ILGenLoadArray(info, elemType, node->elemType); ILGenAdjust(info, -1); ILGenCast(info, elemType, node->varType); + if(node->doCast) + { + ILGenCast(info, ILNode_GenValue(node->doCast, info), node->varType); + } ILGenStoreLocal(info, node->varIndex); ILGenAdjust(info, -1);