Author: sudha
Date: 2005-04-22 03:50:05 -0400 (Fri, 22 Apr 2005)
New Revision: 43432

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/VBBinder.cs
Log:
Support for 'LateGet'


Modified: 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
===================================================================
--- 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
      2005-04-22 07:05:24 UTC (rev 43431)
+++ 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/ChangeLog
      2005-04-22 07:50:05 UTC (rev 43432)
@@ -1,3 +1,8 @@
+2005-04-22  Satya Sudha K <[EMAIL PROTECTED]>
+       * LateBinding.cs: 
+       * VBBinder.cs  : 
+                       - Support for the basic 'LateGet'. (Yet to be tested)
+
 2005-04-21  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * DefaultArgumentValueAttribute.cs: Remove any trace of executable

Modified: 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs
 2005-04-22 07:05:24 UTC (rev 43431)
+++ 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/LateBinding.cs
 2005-04-22 07:50:05 UTC (rev 43432)
@@ -5,6 +5,7 @@
 //   Chris J Breisch ([EMAIL PROTECTED]) 
 //   Marco Ridoni    ([EMAIL PROTECTED])
 //   Dennis Hayes ([EMAIL PROTECTED])
+//   Satya Sudha K ([EMAIL PROTECTED])
 //
 // (C) 2002 Chris J Breisch
 // (C) 2003 Marco Ridoni
@@ -48,44 +49,40 @@
 
                [System.Diagnostics.DebuggerHiddenAttribute] 
                [System.Diagnostics.DebuggerStepThroughAttribute] 
-               public static object LateGet(
-                       object o,
-                       Type objType,
-                       string name,
-                       object[] args,
-                       string[] paramnames,
-                       bool[] CopyBack) {
+               public static object LateGet(object o,
+                                            Type objType,
+                                            string name,
+                                            object[] args,
+                                            string[] paramnames,
+                                            bool[] CopyBack) {
 
-                       BindingFlags invokeAttr = 0;
-
                        if (objType == null) {
-                               if (o == null)
+                               if (o == null) {
                                        throw new NullReferenceException();
+                               }
                                objType = o.GetType();
                        }
-                       Type[] typeArr = null;
-                       if (args != null) {
-                               typeArr = new Type[args.Length];
-                               for (int i = 0; i < typeArr.Length; i++) {
-                                       typeArr[i] = args[i].GetType();
-                               }
-                       }
 
-                       MemberInfo[] memberInfo = objType.GetMember(name);
+                       IReflect objReflect = (IReflect) objType;
 
-                       if (((memberInfo == null) || (memberInfo.Length == 0))) 
-                               throw new NullReferenceException();
+                       BindingFlags flags = BindingFlags.FlattenHierarchy |
+                                            BindingFlags.IgnoreCase |
+                                            BindingFlags.Instance |
+                                            BindingFlags.Public |
+                                            BindingFlags.Static |
+                                            BindingFlags.InvokeMethod;
 
-                       if (memberInfo[0] is MethodInfo) 
-                               invokeAttr = BindingFlags.InvokeMethod;
-                       else if (memberInfo[0] is PropertyInfo) 
-                               invokeAttr = BindingFlags.GetProperty;
-                       else if (memberInfo[0] is FieldInfo) 
-                               invokeAttr = BindingFlags.GetField;
-                       else 
-                               throw new NullReferenceException();
+                       if (name == null) {
+                               name = "";
+                       }
+                       MemberInfo [] memberinfo = objReflect.GetMember (name, 
flags);
 
-                       return objType.InvokeMember(name, invokeAttr, null, o, 
args);
+                       if (memberinfo == null || memberinfo.Length == 0) {
+                               throw new MissingMemberException ("Public 
Member '" + name + "' not found on type '" + objType + "'");
+                       }
+
+                       VBBinder binder = new VBBinder (CopyBack);
+                       return binder.InvokeMember (name, flags, objType, 
objReflect, o, args, null, null, paramnames);
                }
 
                [System.Diagnostics.DebuggerStepThroughAttribute] 

Modified: 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/VBBinder.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/VBBinder.cs
    2005-04-22 07:05:24 UTC (rev 43431)
+++ 
trunk/mcs/class/Microsoft.VisualBasic/Microsoft.VisualBasic.CompilerServices/VBBinder.cs
    2005-04-22 07:50:05 UTC (rev 43432)
@@ -80,7 +80,6 @@
                private bool[] byRefFlags;
                private Type objectType;
                private string bindToName;
-               private bool usesParamArray;
 
                public override MethodBase BindToMethod(
                        BindingFlags bindingAttr,
@@ -348,6 +347,8 @@
                                paramArrayIndex = parameters.GetUpperBound (0) 
- 1;
                                minParams --;
                        }
+                       if (minParams == 0 && numArgs == 0)
+                               return ConversionType.Exact;
                        if (numArgs < minParams)
                                return ConversionType.None;
                        if (! usesParamArray && numArgs != numParams) {
@@ -551,14 +552,6 @@
                        return retVal;
                }
 
-               private bool ByRefParamsExist (ParameterInfo [] pars) {
-                       foreach (ParameterInfo p in pars) {
-                               if (p.ParameterType.IsByRef)
-                                       return true;
-                       }
-                       return false;
-               }
-
                private bool IsApplicable (MethodBase mb, object [] args) {
                        ParameterInfo [] parameters = mb.GetParameters ();
                        int numFixedParams = parameters.Length;

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

Reply via email to