Author: alexandre
Date: 2005-11-21 20:34:43 -0500 (Mon, 21 Nov 2005)
New Revision: 53333

Modified:
   trunk/mcs/mbas/ChangeLog
   trunk/mcs/mbas/Test/tests/types/DateLiterals.vb
   trunk/mcs/mbas/expression.cs
   trunk/mcs/mbas/mb-parser.jay
   trunk/mcs/mbas/typemanager.cs
Log:
2005-11-16 Maverson Eduardo Schulze Rosa <[EMAIL PROTECTED]>
        * mb-parser.jay: Do not create a set_block with ReadOnly Properties.
        * typemanager.cs: Search for correct DefaultPropName and the class
         Type that contains the Default Property.
        * expression.cs: Send the correct Type for porperties search;
        Fix Error with uses of default properties without a Default Property 
         definition.


Modified: trunk/mcs/mbas/ChangeLog
===================================================================
--- trunk/mcs/mbas/ChangeLog    2005-11-21 23:04:53 UTC (rev 53332)
+++ trunk/mcs/mbas/ChangeLog    2005-11-22 01:34:43 UTC (rev 53333)
@@ -1,3 +1,11 @@
+2005-11-16 Maverson Eduardo Schulze Rosa <[EMAIL PROTECTED]>
+       * mb-parser.jay: Do not create a set_block with ReadOnly Properties.
+       * typemanager.cs: Search for correct DefaultPropName and the class
+       Type that contains the Default Property.
+       * expression.cs: Send the correct Type for porperties search;
+       Fix Error with uses of default properties without a Default Property
+       definition.
+       
 2005-11-09 Renato Suga <[EMAIL PROTECTED]>
        * mb-parser.jay: added STOP to statement rule to allow a keyword STOP
        in an iteration_statement.

Modified: trunk/mcs/mbas/Test/tests/types/DateLiterals.vb
===================================================================
--- trunk/mcs/mbas/Test/tests/types/DateLiterals.vb     2005-11-21 23:04:53 UTC 
(rev 53332)
+++ trunk/mcs/mbas/Test/tests/types/DateLiterals.vb     2005-11-22 01:34:43 UTC 
(rev 53333)
@@ -1,5 +1,11 @@
+Imports System.Threading
+Imports System.Globalization
+
 Module DateLiterals
     Sub Main()
+    Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
+       
+
         Dim d As Date
        dim d1 as Date
 

Modified: trunk/mcs/mbas/expression.cs
===================================================================
--- trunk/mcs/mbas/expression.cs        2005-11-21 23:04:53 UTC (rev 53332)
+++ trunk/mcs/mbas/expression.cs        2005-11-22 01:34:43 UTC (rev 53333)
@@ -7364,17 +7364,22 @@
                        if (ix != null)
                                return ix;
 
-                       string p_name = TypeManager.IndexerPropertyName 
(lookup_type);
+                       Type innerType;
+                       string p_name = TypeManager.IndexerPropertyName 
(lookup_type, out innerType);
+                       
+                       if ( p_name == null )
+                               return null;
 
                        MemberInfo [] mi = TypeManager.MemberLookup (
-                               caller_type, lookup_type, MemberTypes.Property,
+                               caller_type, innerType, MemberTypes.Property,
                                BindingFlags.Public | BindingFlags.Instance, 
p_name);
 
                        if (mi == null || mi.Length == 0)
                                return null;
 
                        ix = new Indexers (mi);
-                       map [lookup_type] = ix;
+                       //map [lookup_type] = ix;
+                       map [innerType] = ix;
 
                        return ix;
                }
@@ -7470,10 +7475,14 @@
                                        current_type, indexer_type, loc);
 
                                if (ilist == null && indexer_type != 
TypeManager.object_type) {
-                                       Report.Error (21, loc,
+                                       Report.Error (30367, loc,
                                                "Type '" + 
TypeManager.MonoBASIC_Name (indexer_type) +
                                                "' does not have any indexers 
defined");
                                        return null;
+                                       //Report.Error (21, loc,
+                                       //              "Type '" + 
TypeManager.MonoBASIC_Name (indexer_type) +
+                                       //              "' does not have any 
indexers defined");
+                                       //return null;
                                }
                        }
 

Modified: trunk/mcs/mbas/mb-parser.jay
===================================================================
--- trunk/mcs/mbas/mb-parser.jay        2005-11-21 23:04:53 UTC (rev 53332)
+++ trunk/mcs/mbas/mb-parser.jay        2005-11-22 01:34:43 UTC (rev 53333)
@@ -2075,7 +2075,11 @@
                lexer.PropertyParsing = true;
                
                Accessor get_block = new Accessor (null, null); 
-               Accessor set_block = new Accessor (null, null); 
+
+               Accessor set_block = null;
+
+               if ((current_modifiers & Modifiers.READONLY) == 0)
+                       set_block = new Accessor (null, null);  
                
                int modifiers = (implicit_modifiers) ? (current_modifiers & ~ 
(Modifiers.STATIC) ): current_modifiers;
                Property prop = new Property ((Expression) ftype, (string) $2, 
modifiers,

Modified: trunk/mcs/mbas/typemanager.cs
===================================================================
--- trunk/mcs/mbas/typemanager.cs       2005-11-21 23:04:53 UTC (rev 53332)
+++ trunk/mcs/mbas/typemanager.cs       2005-11-22 01:34:43 UTC (rev 53333)
@@ -2016,8 +2016,10 @@
        ///
        ///   For example, the String class indexer is named 'Chars' not 'Item' 
        /// </remarks>
-       public static string IndexerPropertyName (Type t)
+       public static string IndexerPropertyName (Type t, out Type innerType)
        {
+               innerType = t;
+               
                if (t is TypeBuilder) {
                        if (t.IsInterface) {
                                Interface i = LookupInterface (t);
@@ -2029,9 +2031,30 @@
                        } else {
                                TypeContainer tc = LookupTypeContainer (t);
 
-                               if ((tc == null) || (tc.DefaultPropName == 
null))
-                                       return "Item";
+                               if ( tc == null )
+                                       return null;
 
+                               if ( tc.DefaultPropName == null )
+                               {
+                                       while ( tc is Class )
+                                       {
+                                               innerType = innerType.BaseType;
+                                               
+                                               tc = LookupTypeContainer 
(innerType);
+                                               
+                                               if (tc == null)
+                                               {       
+                                                       innerType = t;
+                                                       return null;
+                                               }
+                                               else if ( tc.DefaultPropName != 
null )
+                                                       return 
tc.DefaultPropName;
+                                       }
+                               }
+                               
+                               //if ((tc == null) || (tc.DefaultPropName == 
null))
+                               //      return "Item";
+
                                return tc.DefaultPropName;
                        }
                }

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

Reply via email to