Author: sudha
Date: 2005-03-22 06:11:12 -0500 (Tue, 22 Mar 2005)
New Revision: 42098

Modified:
   trunk/mcs/mbas/ChangeLog
   trunk/mcs/mbas/expression.cs
   trunk/mcs/mbas/mb-parser.jay
Log:
Fix for 'MyClass' instance expression


Modified: trunk/mcs/mbas/ChangeLog
===================================================================
--- trunk/mcs/mbas/ChangeLog    2005-03-22 11:09:19 UTC (rev 42097)
+++ trunk/mcs/mbas/ChangeLog    2005-03-22 11:11:12 UTC (rev 42098)
@@ -1,4 +1,9 @@
 2005-03-22 Satya Sudha K <[EMAIL PROTECTED]>
+       * mb-parser.jay
+       * expression.cs :
+                       Fix for 'MyClass' instance expressions 
+
+2005-03-22 Satya Sudha K <[EMAIL PROTECTED]>
           Sudharsan V <[EMAIL PROTECTED]>
        * mb-parser.jay : 
                        Removed some conflicts in the grammar

Modified: trunk/mcs/mbas/expression.cs
===================================================================
--- trunk/mcs/mbas/expression.cs        2005-03-22 11:09:19 UTC (rev 42097)
+++ trunk/mcs/mbas/expression.cs        2005-03-22 11:11:12 UTC (rev 42098)
@@ -4818,7 +4818,11 @@
                {
                        ILGenerator ig = ec.ig;
                        bool struct_call = false;
+                       bool is_myclass = false;
 
+                       if (instance_expr is This && ((This) 
instance_expr).AccessType == This.TypeOfAccess.MyClass) 
+                               is_myclass = true;
+
                        Type decl_type = method.DeclaringType;
 
                        if (!RootContext.StdLib) 
@@ -4924,7 +4928,7 @@
 
                        EmitArguments (ec, method, Arguments);
 
-                       if (is_static || struct_call || is_base)
+                       if (is_static || struct_call || is_base || is_myclass)
                        {
                                if (method is MethodInfo) 
                                {
@@ -5938,20 +5942,38 @@
        /// </summary>
        public class This : Expression, IAssignMethod, IMemoryLocation, 
IVariable {
 
+               public enum TypeOfAccess : byte {
+                       Me, MyClass
+               }
+
                Block block;
                VariableInfo vi;
+               TypeOfAccess access_type;
                
+               public This (TypeOfAccess access_type, Block block, Location 
loc)
+               {
+                       this.loc = loc;
+                       this.block = block;
+                       this.access_type = access_type;
+               }
+
                public This (Block block, Location loc)
                {
                        this.loc = loc;
                        this.block = block;
+                       this.access_type = TypeOfAccess.Me;
                }
 
                public This (Location loc)
                {
                        this.loc = loc;
+                       this.access_type = TypeOfAccess.Me;
                }
 
+               public TypeOfAccess AccessType { 
+                       get { return access_type; }
+               }
+
                public bool IsAssigned (EmitContext ec, Location loc)
                {
                        if (vi == null)

Modified: trunk/mcs/mbas/mb-parser.jay
===================================================================
--- trunk/mcs/mbas/mb-parser.jay        2005-03-22 11:09:19 UTC (rev 42097)
+++ trunk/mcs/mbas/mb-parser.jay        2005-03-22 11:11:12 UTC (rev 42098)
@@ -4629,9 +4629,7 @@
          }
        | MYCLASS
          {
-               // FIXME: This is actually somewhat different from Me
-               // because it is for accessing static (classifier) 
methods/properties/fields
-               $$ = new This (current_block, lexer.Location);
+               $$ = new This (This.TypeOfAccess.MyClass, current_block, 
lexer.Location);
          }
        ;
 

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

Reply via email to