Pārlūkot izejas kodu

* Added a bunch of Token structs (all are generated from template).
* common.src: added new structs to the build and fixed a small typo.

svn path=/trunk/mcs/; revision=833

Sergey Chaban 24 gadi atpakaļ
vecāks
revīzija
056bbcc693

+ 69 - 0
mcs/class/corlib/System.Reflection.Emit/EventToken.cs

@@ -0,0 +1,69 @@
+// EventToken.cs
+//
+// (C) 2001 Ximian, Inc.  http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+	/// <summary>
+	///  Represents the Token returned by the metadata to represent a Event.
+	/// </summary>
+	public struct EventToken {
+
+		internal int tokValue;
+
+		public static readonly EventToken Empty;
+
+
+		static EventToken ()
+		{
+			Empty = new EventToken ();
+		}
+
+
+		internal EventToken (int val)
+		{
+			tokValue = val;
+		}
+
+
+
+		/// <summary>
+		/// </summary>
+		public override bool Equals (object obj)
+		{
+			bool res = obj is EventToken;
+
+			if (res) {
+				EventToken that = (EventToken) obj;
+				res = (this.tokValue == that.tokValue);
+			}
+
+			return res;
+		}
+
+
+		/// <summary>
+		///  Tests whether the given object is an instance of
+		///  EventToken and has the same token value.
+		/// </summary>
+		public override int GetHashCode ()
+		{
+			return tokValue;
+		}
+
+
+		/// <summary>
+		///  Returns the metadata token for this Event.
+		/// </summary>
+		public int Token {
+			get {
+				return tokValue;
+			}
+		}
+
+	}
+
+}
+

+ 69 - 0
mcs/class/corlib/System.Reflection.Emit/FieldToken.cs

@@ -0,0 +1,69 @@
+// FieldToken.cs
+//
+// (C) 2001 Ximian, Inc.  http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+	/// <summary>
+	///  Represents the Token returned by the metadata to represent a Field.
+	/// </summary>
+	public struct FieldToken {
+
+		internal int tokValue;
+
+		public static readonly FieldToken Empty;
+
+
+		static FieldToken ()
+		{
+			Empty = new FieldToken ();
+		}
+
+
+		internal FieldToken (int val)
+		{
+			tokValue = val;
+		}
+
+
+
+		/// <summary>
+		/// </summary>
+		public override bool Equals (object obj)
+		{
+			bool res = obj is FieldToken;
+
+			if (res) {
+				FieldToken that = (FieldToken) obj;
+				res = (this.tokValue == that.tokValue);
+			}
+
+			return res;
+		}
+
+
+		/// <summary>
+		///  Tests whether the given object is an instance of
+		///  FieldToken and has the same token value.
+		/// </summary>
+		public override int GetHashCode ()
+		{
+			return tokValue;
+		}
+
+
+		/// <summary>
+		///  Returns the metadata token for this Field.
+		/// </summary>
+		public int Token {
+			get {
+				return tokValue;
+			}
+		}
+
+	}
+
+}
+

+ 69 - 0
mcs/class/corlib/System.Reflection.Emit/MethodToken.cs

@@ -0,0 +1,69 @@
+// MethodToken.cs
+//
+// (C) 2001 Ximian, Inc.  http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+	/// <summary>
+	///  Represents the Token returned by the metadata to represent a Method.
+	/// </summary>
+	public struct MethodToken {
+
+		internal int tokValue;
+
+		public static readonly MethodToken Empty;
+
+
+		static MethodToken ()
+		{
+			Empty = new MethodToken ();
+		}
+
+
+		internal MethodToken (int val)
+		{
+			tokValue = val;
+		}
+
+
+
+		/// <summary>
+		/// </summary>
+		public override bool Equals (object obj)
+		{
+			bool res = obj is MethodToken;
+
+			if (res) {
+				MethodToken that = (MethodToken) obj;
+				res = (this.tokValue == that.tokValue);
+			}
+
+			return res;
+		}
+
+
+		/// <summary>
+		///  Tests whether the given object is an instance of
+		///  MethodToken and has the same token value.
+		/// </summary>
+		public override int GetHashCode ()
+		{
+			return tokValue;
+		}
+
+
+		/// <summary>
+		///  Returns the metadata token for this Method.
+		/// </summary>
+		public int Token {
+			get {
+				return tokValue;
+			}
+		}
+
+	}
+
+}
+

+ 69 - 0
mcs/class/corlib/System.Reflection.Emit/ParameterToken.cs

@@ -0,0 +1,69 @@
+// ParameterToken.cs
+//
+// (C) 2001 Ximian, Inc.  http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+	/// <summary>
+	///  Represents the Token returned by the metadata to represent a Parameter.
+	/// </summary>
+	public struct ParameterToken {
+
+		internal int tokValue;
+
+		public static readonly ParameterToken Empty;
+
+
+		static ParameterToken ()
+		{
+			Empty = new ParameterToken ();
+		}
+
+
+		internal ParameterToken (int val)
+		{
+			tokValue = val;
+		}
+
+
+
+		/// <summary>
+		/// </summary>
+		public override bool Equals (object obj)
+		{
+			bool res = obj is ParameterToken;
+
+			if (res) {
+				ParameterToken that = (ParameterToken) obj;
+				res = (this.tokValue == that.tokValue);
+			}
+
+			return res;
+		}
+
+
+		/// <summary>
+		///  Tests whether the given object is an instance of
+		///  ParameterToken and has the same token value.
+		/// </summary>
+		public override int GetHashCode ()
+		{
+			return tokValue;
+		}
+
+
+		/// <summary>
+		///  Returns the metadata token for this Parameter.
+		/// </summary>
+		public int Token {
+			get {
+				return tokValue;
+			}
+		}
+
+	}
+
+}
+

+ 69 - 0
mcs/class/corlib/System.Reflection.Emit/PropertyToken.cs

@@ -0,0 +1,69 @@
+// PropertyToken.cs
+//
+// (C) 2001 Ximian, Inc.  http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+	/// <summary>
+	///  Represents the Token returned by the metadata to represent a Property.
+	/// </summary>
+	public struct PropertyToken {
+
+		internal int tokValue;
+
+		public static readonly PropertyToken Empty;
+
+
+		static PropertyToken ()
+		{
+			Empty = new PropertyToken ();
+		}
+
+
+		internal PropertyToken (int val)
+		{
+			tokValue = val;
+		}
+
+
+
+		/// <summary>
+		/// </summary>
+		public override bool Equals (object obj)
+		{
+			bool res = obj is PropertyToken;
+
+			if (res) {
+				PropertyToken that = (PropertyToken) obj;
+				res = (this.tokValue == that.tokValue);
+			}
+
+			return res;
+		}
+
+
+		/// <summary>
+		///  Tests whether the given object is an instance of
+		///  PropertyToken and has the same token value.
+		/// </summary>
+		public override int GetHashCode ()
+		{
+			return tokValue;
+		}
+
+
+		/// <summary>
+		///  Returns the metadata token for this Property.
+		/// </summary>
+		public int Token {
+			get {
+				return tokValue;
+			}
+		}
+
+	}
+
+}
+

+ 69 - 0
mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs

@@ -0,0 +1,69 @@
+// SignatureToken.cs
+//
+// (C) 2001 Ximian, Inc.  http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+	/// <summary>
+	///  Represents the Token returned by the metadata to represent a Signature.
+	/// </summary>
+	public struct SignatureToken {
+
+		internal int tokValue;
+
+		public static readonly SignatureToken Empty;
+
+
+		static SignatureToken ()
+		{
+			Empty = new SignatureToken ();
+		}
+
+
+		internal SignatureToken (int val)
+		{
+			tokValue = val;
+		}
+
+
+
+		/// <summary>
+		/// </summary>
+		public override bool Equals (object obj)
+		{
+			bool res = obj is SignatureToken;
+
+			if (res) {
+				SignatureToken that = (SignatureToken) obj;
+				res = (this.tokValue == that.tokValue);
+			}
+
+			return res;
+		}
+
+
+		/// <summary>
+		///  Tests whether the given object is an instance of
+		///  SignatureToken and has the same token value.
+		/// </summary>
+		public override int GetHashCode ()
+		{
+			return tokValue;
+		}
+
+
+		/// <summary>
+		///  Returns the metadata token for this Signature.
+		/// </summary>
+		public int Token {
+			get {
+				return tokValue;
+			}
+		}
+
+	}
+
+}
+

+ 69 - 0
mcs/class/corlib/System.Reflection.Emit/StringToken.cs

@@ -0,0 +1,69 @@
+// StringToken.cs
+//
+// (C) 2001 Ximian, Inc.  http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+	/// <summary>
+	///  Represents the Token returned by the metadata to represent a String.
+	/// </summary>
+	public struct StringToken {
+
+		internal int tokValue;
+
+		public static readonly StringToken Empty;
+
+
+		static StringToken ()
+		{
+			Empty = new StringToken ();
+		}
+
+
+		internal StringToken (int val)
+		{
+			tokValue = val;
+		}
+
+
+
+		/// <summary>
+		/// </summary>
+		public override bool Equals (object obj)
+		{
+			bool res = obj is StringToken;
+
+			if (res) {
+				StringToken that = (StringToken) obj;
+				res = (this.tokValue == that.tokValue);
+			}
+
+			return res;
+		}
+
+
+		/// <summary>
+		///  Tests whether the given object is an instance of
+		///  StringToken and has the same token value.
+		/// </summary>
+		public override int GetHashCode ()
+		{
+			return tokValue;
+		}
+
+
+		/// <summary>
+		///  Returns the metadata token for this String.
+		/// </summary>
+		public int Token {
+			get {
+				return tokValue;
+			}
+		}
+
+	}
+
+}
+

+ 69 - 0
mcs/class/corlib/System.Reflection.Emit/TypeToken.cs

@@ -0,0 +1,69 @@
+// TypeToken.cs
+//
+// (C) 2001 Ximian, Inc.  http://www.ximian.com
+
+
+namespace System.Reflection.Emit {
+
+
+	/// <summary>
+	///  Represents the Token returned by the metadata to represent a Type.
+	/// </summary>
+	public struct TypeToken {
+
+		internal int tokValue;
+
+		public static readonly TypeToken Empty;
+
+
+		static TypeToken ()
+		{
+			Empty = new TypeToken ();
+		}
+
+
+		internal TypeToken (int val)
+		{
+			tokValue = val;
+		}
+
+
+
+		/// <summary>
+		/// </summary>
+		public override bool Equals (object obj)
+		{
+			bool res = obj is TypeToken;
+
+			if (res) {
+				TypeToken that = (TypeToken) obj;
+				res = (this.tokValue == that.tokValue);
+			}
+
+			return res;
+		}
+
+
+		/// <summary>
+		///  Tests whether the given object is an instance of
+		///  TypeToken and has the same token value.
+		/// </summary>
+		public override int GetHashCode ()
+		{
+			return tokValue;
+		}
+
+
+		/// <summary>
+		///  Returns the metadata token for this Type.
+		/// </summary>
+		public int Token {
+			get {
+				return tokValue;
+			}
+		}
+
+	}
+
+}
+

+ 10 - 2
mcs/class/corlib/System.Reflection.Emit/common.src

@@ -1,11 +1,19 @@
 AssemblyBuilderAccess.cs
+EventToken.cs
+FieldToken.cs
 FlowControl.cs
-IlGenerator.cs
+ILGenerator.cs
 Label.cs
+MethodToken.cs
 OpCode.cs
-OpCodeType.cs
 OpCodes.cs
+OpCodeType.cs
 OperandType.cs
 PackingSize.cs
+ParameterToken.cs
 PEFileKinds.cs
+PropertyToken.cs
+SignatureToken.cs
 StackBehaviour.cs
+StringToken.cs
+TypeToken.cs