[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnet/codegen cg_misc.tc, 1.47, 1.48 cg_nodes.tc, 1
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnet/codegen cg_misc.tc, 1.47, 1.48 cg_nodes.tc, 1.82, 1.83 jv_misc.tc, 1.29, 1.30 |
Date: |
Fri, 07 Nov 2003 00:12:38 +0000 |
Update of /cvsroot/dotgnu-pnet/pnet/codegen
In directory subversions:/tmp/cvs-serv13213/codegen
Modified Files:
cg_misc.tc cg_nodes.tc jv_misc.tc
Log Message:
Add the "Type.default" idiom to the C# compiler, for C# 2.0 compatibility.
Index: cg_nodes.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_nodes.tc,v
retrieving revision 1.82
retrieving revision 1.83
diff -C2 -d -r1.82 -r1.83
*** cg_nodes.tc 17 Aug 2003 23:33:17 -0000 1.82
--- cg_nodes.tc 7 Nov 2003 00:12:36 -0000 1.83
***************
*** 485,488 ****
--- 485,489 ----
%node ILNode_DefaultConstructor ILNode_Expression =
{
+ ILNode *expr;
ILType *type;
}
Index: jv_misc.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/jv_misc.tc,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** jv_misc.tc 20 Apr 2003 06:04:31 -0000 1.29
--- jv_misc.tc 7 Nov 2003 00:12:36 -0000 1.30
***************
*** 1511,1514 ****
--- 1511,1542 ----
break;
+ case ILMachineType_String:
+ case ILMachineType_ObjectRef:
+ {
+ JavaGenSimple(info, JAVA_OP_ACONST_NULL);
+ JavaGenAdjust(info, 1);
+ }
+ break;
+
+ case ILMachineType_Decimal:
+ {
+ if(info->useJavaLib)
+ {
+ JavaGenSimple(info, JAVA_OP_LCONST_0);
+ JavaGenCallByName(info, "java/math/BigDecimal",
"valueOf",
+
"(J)Ljava/math/BigDecimal;");
+ JavaGenExtend(info, 2);
+ JavaGenAdjust(info, 1);
+ }
+ else
+ {
+ JavaGenSimple(info, JAVA_OP_ICONST_0);
+ JavaGenCallByName(info, "System/Decimal",
"op_Implicit__iV",
+
"(I)LSystem/Decimal;");
+ JavaGenAdjust(info, 1);
+ }
+ }
+ break;
+
default:
{
Index: cg_misc.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_misc.tc,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** cg_misc.tc 3 Apr 2003 22:52:41 -0000 1.47
--- cg_misc.tc 7 Nov 2003 00:12:36 -0000 1.48
***************
*** 1217,1220 ****
--- 1217,1237 ----
break;
+ case ILMachineType_String:
+ case ILMachineType_ObjectRef:
+ {
+ ILGenSimple(info, IL_OP_LDNULL);
+ ILGenAdjust(info, 1);
+ }
+ break;
+
+ case ILMachineType_Decimal:
+ {
+ ILGenSimple(info, IL_OP_LDC_I4_0);
+ ILGenCallByName(info, "valuetype
[.library]System.Decimal "
+
"[.library]System.Decimal::op_Implicit(int32)");
+ ILGenAdjust(info, 1);
+ }
+ break;
+
default:
{
***************
*** 2750,2753 ****
--- 2767,2840 ----
/* Evaluate the expression */
return ILNode_EvalConst(node->expression, info, value);
+ }
+
+ /*
+ * Evaluate the constant value of a default constructor.
+ */
+ ILNode_EvalConst(ILNode_DefaultConstructor)
+ {
+ ILMachineType type = ILTypeToMachineType(node->type);
+ switch(type)
+ {
+ case ILMachineType_Boolean:
+ case ILMachineType_Int8:
+ case ILMachineType_UInt8:
+ case ILMachineType_Int16:
+ case ILMachineType_UInt16:
+ case ILMachineType_Char:
+ case ILMachineType_Int32:
+ case ILMachineType_UInt32:
+ {
+ value->valueType = type;
+ value->un.i4Value = 0;
+ return 1;
+ }
+ /* Not reached */
+
+ case ILMachineType_Int64:
+ case ILMachineType_UInt64:
+ {
+ value->valueType = type;
+ value->un.i8Value = 0;
+ return 1;
+ }
+ /* Not reached */
+
+ case ILMachineType_Float32:
+ {
+ value->valueType = type;
+ value->un.r4Value = (ILFloat)0.0;
+ return 1;
+ }
+ /* Not reached */
+
+ case ILMachineType_Float64:
+ {
+ value->valueType = type;
+ value->un.r8Value = (ILDouble)0.0;
+ return 1;
+ }
+ /* Not reached */
+
+ case ILMachineType_String:
+ case ILMachineType_ObjectRef:
+ {
+ value->valueType = ILMachineType_ObjectRef;
+ value->un.oValue = 0;
+ return 1;
+ }
+ /* Not reached */
+
+ case ILMachineType_Decimal:
+ {
+ value->valueType = type;
+ ILDecimalFromInt32(&(value->un.decValue), 0);
+ return 1;
+ }
+ /* Not reached */
+
+ default: break;
+ }
+ return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnet/codegen cg_misc.tc, 1.47, 1.48 cg_nodes.tc, 1.82, 1.83 jv_misc.tc, 1.29, 1.30,
Rhys Weatherley <address@hidden> <=