Kaynağa Gözat

Fix for 'MyClass' instance expression

svn path=/trunk/mcs/; revision=42098
Satya Sudha K 21 yıl önce
ebeveyn
işleme
fd33ebbc47
3 değiştirilmiş dosya ile 29 ekleme ve 4 silme
  1. 5 0
      mcs/mbas/ChangeLog
  2. 23 1
      mcs/mbas/expression.cs
  3. 1 3
      mcs/mbas/mb-parser.jay

+ 5 - 0
mcs/mbas/ChangeLog

@@ -1,3 +1,8 @@
+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 : 

+ 23 - 1
mcs/mbas/expression.cs

@@ -4818,6 +4818,10 @@ namespace Mono.MonoBASIC {
 		{
 			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;
 
@@ -4924,7 +4928,7 @@ namespace Mono.MonoBASIC {
 
 			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,18 +5942,36 @@ namespace Mono.MonoBASIC {
 	/// </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)

+ 1 - 3
mcs/mbas/mb-parser.jay

@@ -4629,9 +4629,7 @@ this_access
 	  }
 	| 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);
 	  }
 	;