Author: sudha
Date: 2005-05-04 02:01:38 -0400 (Wed, 04 May 2005)
New Revision: 44002

Modified:
   
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
   
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs
   
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
Log:
* LateBinding.cs: Removed the 'CopyBack' param from the 'LateSet' method (to 
make it consistent with vbc)
* ObjectType.cs : Implemented the 'GetWidestType' method



Modified: 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
===================================================================
--- 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
      2005-05-04 03:27:52 UTC (rev 44001)
+++ 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
      2005-05-04 06:01:38 UTC (rev 44002)
@@ -1,3 +1,7 @@
+2005-05-04  Satya Sudha K <[EMAIL PROTECTED]>
+       * LateBinding.cs: Removed the 'CopyBack' param from the 'LateSet' 
method (to make it consistent with vbc)
+       * ObjectType.cs : Implemented the 'GetWidestType' method
+
 2005-04-29  Satya Sudha K <[EMAIL PROTECTED]>
        * LateBinding.cs: 
        * VBBinder.cs  : 

Modified: 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs
 2005-05-04 03:27:52 UTC (rev 44001)
+++ 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs
 2005-05-04 06:01:38 UTC (rev 44002)
@@ -102,7 +102,7 @@
                        bool OptimisticSet,
                        bool RValueBase) 
                {
-                       LateSet(o, objType, name, args, paramnames, null);
+                       LateSet(o, objType, name, args, paramnames);
                }
 
                [System.Diagnostics.DebuggerStepThroughAttribute] 
@@ -111,8 +111,7 @@
                                            Type objType,
                                            string name,
                                            object[] args,
-                                           string[] paramnames,
-                                           bool[] CopyBack) {
+                                           string[] paramnames) {
 
                        if (objType == null) {
                                if (o == null)

Modified: 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
  2005-05-04 03:27:52 UTC (rev 44001)
+++ 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ObjectType.cs
  2005-05-04 06:01:38 UTC (rev 44002)
@@ -1007,14 +1007,96 @@
                }
 
                //checked + string//make typecode
-               [MonoTODO]
                internal static TypeCode GetWidestType(TypeCode type1, TypeCode 
type2) {
-                       //int index1 = getVTypeFromTypeCode(type1);
-                       //int index2 = getVTypeFromTypeCode(type2);
-                       //return getTypeCodeFromVType(WiderType(index1,index2));
-                       //TODO:
-                       throw new NotImplementedException("GetWidest type nneds 
repair");
-                       //return 
(TypeCode)getTypeCodeFromVType((int)WiderType[(int)type1,(int)type2]);
+                       if (type1 == type2)
+                               return type1;
+
+                       if (type1 == TypeCode.Char || type2 == TypeCode.Char) {
+                               if (type1 == TypeCode.Char && type2 == 
TypeCode.String)
+                                       return TypeCode.String;
+                               if (type2 == TypeCode.Char && type1 == 
TypeCode.String)
+                                       return TypeCode.String;
+                               return TypeCode.Empty;
+                       }
+                       if (type1 == TypeCode.DateTime || type2 == 
TypeCode.DateTime) {
+                               if (type1 == TypeCode.String && type2 == 
TypeCode.DateTime)
+                                       return TypeCode.DateTime;
+                               if (type2 == TypeCode.String && type1 == 
TypeCode.DateTime)
+                                       return TypeCode.DateTime;
+                               return TypeCode.Empty;
+                       }
+
+                       switch (type1) {
+                       case TypeCode.Boolean :
+                               switch (type2) {
+                               case TypeCode.Byte :
+                                       return type1;
+                               case TypeCode.String:
+                                       return TypeCode.Double;
+                               }
+                               return type2;
+                       case TypeCode.Byte :
+                               switch (type2) {
+                               case TypeCode.String:
+                                       return TypeCode.Double;
+                               }
+                               return type2;
+                       case TypeCode.Int16 :
+                               switch (type2) {
+                               case TypeCode.Boolean:
+                               case TypeCode.Byte:
+                                       return type1;
+                               case TypeCode.String:
+                                       return TypeCode.Double;
+                               }
+                               return type2;
+                       case TypeCode.Int32 :
+                               switch (type2) {
+                               case TypeCode.Boolean:
+                               case TypeCode.Byte:
+                               case TypeCode.Int16:
+                                       return type1;
+                               case TypeCode.String:
+                                       return TypeCode.Double;
+                               }
+                               return type2;
+                       case TypeCode.Int64 :
+                               switch (type2) {
+                               case TypeCode.Single:
+                               case TypeCode.Double:
+                               case TypeCode.Decimal:
+                                       return type1;
+                               case TypeCode.String:
+                                       return TypeCode.Double;
+                               }
+                               return type1;
+                       case TypeCode.Decimal :
+                               switch (type2) {
+                               case TypeCode.Single:
+                               case TypeCode.Double:
+                                       return type2;
+                               case TypeCode.String:
+                                       return TypeCode.Double;
+                               }
+                               return type1;
+                       case TypeCode.Single :
+                               switch (type2) {
+                               case TypeCode.Double:
+                                       return type2;
+                               case TypeCode.String:
+                                       return TypeCode.Double;
+                               }
+                               return type1;
+                       case TypeCode.Double :
+                               switch (type2) {
+                               case TypeCode.String:
+                                       return type1;
+                               }
+                               return type1;
+                       case TypeCode.String :
+                               return TypeCode.Double;
+                       }
+                       return TypeCode.Object;
                }
     
                internal static TypeCode GetWidestType(object obj1, TypeCode 
typeCode2) {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to