Patch adds out of order class initialization on demand + default
ToString() for object.
(test commented out, because there's no operator== for strings yet)
Index: Kernel/Tests/CS/Object.cs
===================================================================
--- Kernel/Tests/CS/Object.cs	(wersja 823)
+++ Kernel/Tests/CS/Object.cs	(kopia robocza)
@@ -56,5 +56,13 @@
 
 			return 0;
 		}
+
+		public static uint CMPDefaultToString ()
+		{
+//			if (new object().ToString() == "System.Object")
+//				return 1;
+
+			return 0;
+		}
 	}
 }
\ brakuje znaku końca linii na końcu pliku 
Index: Kernel/Core/Korlib/System/Object.cs
===================================================================
--- Kernel/Core/Korlib/System/Object.cs	(wersja 823)
+++ Kernel/Core/Korlib/System/Object.cs	(kopia robocza)
@@ -20,5 +20,10 @@
 		public Object ()
 		{
 		}
+		
+		public virtual string ToString()
+		{
+			return this.VTable.Type.Name;
+		}
 	}
 }
\ brakuje znaku końca linii na końcu pliku 
Index: AOT/Core/IR/Class.cs
===================================================================
--- AOT/Core/IR/Class.cs	(wersja 823)
+++ AOT/Core/IR/Class.cs	(kopia robocza)
@@ -38,6 +38,8 @@
 			this.classDefinition = classDefinition;
 		}
 
+		private int setupStep = -1;
+
 		/// <summary>
 		/// Setups this instance.
 		/// </summary>
@@ -52,6 +54,10 @@
 		/// </summary>
 		public void Setup (int step)
 		{
+			if (setupStep >= step)
+				return;
+			setupStep = step;
+
 			if (this.classDefinition is TypeDefinition) {
 				TypeDefinition typeDefinition = this.classDefinition as TypeDefinition;
 
@@ -89,6 +95,15 @@
 					if (this.TypeFullName != Mono.Cecil.Constants.Object && !this.isInterface)
 						this._base = this.engine.GetClass (typeDefinition.BaseType);
 					
+					// initialize base class before marking virtual methods
+					if (this._base != null)
+						this._base.Setup (step);
+
+					// initialize base interfaces before marking interface methods
+					foreach (TypeReference interfaceRef in (this.ClassDefinition as TypeDefinition).Interfaces) {
+						this.engine.GetClass(interfaceRef).Setup (step);
+					}
+
 					this.MarkInterfaceMethods ();
 					this.AddVirtualMethods (this.virtualMethods);
 
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
SharpOS-Developers mailing list
SharpOS-Developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sharpos-developers

Reply via email to