--- /opt/cvs/dotgnu/pnet/cscc/csharp/cs_lvalue.tc Sat Sep 7 13:58:06 2002 +++ /tmp/dotgnu/pnet/cscc/csharp/cs_lvalue.tc Sun Sep 15 16:09:19 2002 @@ -21,6 +21,41 @@ %{ /* + * Helper macro ... + */ +#define _CONVERT_TYPE(machineType,type) \ + case machineType: \ + return type; \ + break +ILType* ILMachineTypeToILType(ILGenInfo *info,ILMachineType type) +{ + switch(type) + { + _CONVERT_TYPE(ILMachineType_Boolean,ILType_Boolean); + _CONVERT_TYPE(ILMachineType_Int8,ILType_Int8); + _CONVERT_TYPE(ILMachineType_UInt8,ILType_UInt8); + _CONVERT_TYPE(ILMachineType_Int16,ILType_Int16); + _CONVERT_TYPE(ILMachineType_UInt16,ILType_UInt16); + _CONVERT_TYPE(ILMachineType_Char,ILType_Char); + _CONVERT_TYPE(ILMachineType_Int32,ILType_Int32); + _CONVERT_TYPE(ILMachineType_UInt32,ILType_UInt32); + _CONVERT_TYPE(ILMachineType_Int64,ILType_Int64); + _CONVERT_TYPE(ILMachineType_UInt64,ILType_UInt64); + _CONVERT_TYPE(ILMachineType_Float32,ILType_Float32); + _CONVERT_TYPE(ILMachineType_Float64,ILType_Float64); + _CONVERT_TYPE(ILMachineType_String, + ILFindSystemType(info,"String")); + _CONVERT_TYPE(ILMachineType_Decimal, + ILFindSystemType(info,"Decimal")); + default: + /* To avoid an error message about the other elements of + the enum */ + break; + } + return ILType_Void; +} + +/* * Check to see if we are permitted to use the "this" expression * to access an instance member. */ @@ -856,7 +891,6 @@ synthesised when ILNode_Identifier is analysed */ return CSSemValueDefault; } - /* * Perform semantic analysis for member access operators. */ @@ -865,10 +899,19 @@ CSSemValue value; CSSemValue value2; char *name; + ILEvalValue evalue; /* Get the semantic value for the left part of the identifier */ value = ILNode_SemAnalysis(node->expr1, info, &(node->expr1)); + if(yyisa(node->expr1,ILNode_Constant)) + { + ILNode_EvalConst(node->expr1,info,&evalue); + /* Set the RValue to the type .. to handle Boxing later on*/ + CSSemSetRValue(value, + ILMachineTypeToILType(info,evalue.valueType)); + } + /* Resolve the member */ name = ILQualIdentName(node->expr2, 0); value2 = CSResolveMemberName(info, (ILNode *)node, value, name);