[Mono-dev] c# compilater - mcs

Denis ERCHOFF d_erchoff at hotmail.com
Fri Mar 31 08:14:40 EST 2006


Hi, 

For educational purpose i'am looking at the c# compilater.

Here is a part of my code : 

using System;

/namespace Test
{
	public class Test : System.Web.UI.UserControl
	{
		public int field;

		public void TestMethod()
		{
			///field// /= 0;
			System.Console.WriteLine( ///field///.ToString() );
		}
	}

	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	class Class1
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			Test t = new Test();
			t.///TestMethod///();
		}
	}
}
/
So my class Test has a field named "/field/" called by the method "//TestMethod//". 
While the compilater is parsing the file, i see ( in debug mode ) that a "/SimpleName/" class expression is created to handle the reference to "/field/" in the method "/TestMethod/". 

But i have no clue when the compilater links the simple name to the "/Test/" class field : if a write "/this.field/" a "/MemberAcess/" class is created and in this case it is clear how the compilater does "the link".
When the simple name class is emitted ? When it is transformed in a "/MemberAcces/" ( if it does it )? 

Thanks for the answer.




More information about the Mono-devel-list mailing list