當前位置: 首頁>>代碼示例>>C#>>正文


C# TypeSpec.GetMetaInfo方法代碼示例

本文整理匯總了C#中System.TypeSpec.GetMetaInfo方法的典型用法代碼示例。如果您正苦於以下問題:C# TypeSpec.GetMetaInfo方法的具體用法?C# TypeSpec.GetMetaInfo怎麽用?C# TypeSpec.GetMetaInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.TypeSpec的用法示例。


在下文中一共展示了TypeSpec.GetMetaInfo方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: BeginCatchBlock

		public void BeginCatchBlock (TypeSpec type)
		{
			if (IsAnonymousStoreyMutateRequired)
				type = CurrentAnonymousMethod.Storey.Mutator.Mutate (type);

			ig.BeginCatchBlock (type.GetMetaInfo ());
		}
開發者ID:blinds52,項目名稱:mono,代碼行數:7,代碼來源:codegen.cs

示例2: DeclareLocal

		public LocalBuilder DeclareLocal (TypeSpec type, bool pinned)
		{
			if (IsAnonymousStoreyMutateRequired)
				type = CurrentAnonymousMethod.Storey.Mutator.Mutate (type);

			return ig.DeclareLocal (type.GetMetaInfo (), pinned);
		}
開發者ID:blinds52,項目名稱:mono,代碼行數:7,代碼來源:codegen.cs

示例3: AddTypeForwarder

		public void AddTypeForwarder (TypeSpec type, Location loc)
		{
			try {
				if (add_type_forwarder == null) {
					add_type_forwarder = typeof (AssemblyBuilder).GetMethod ("AddTypeForwarder", BindingFlags.NonPublic | BindingFlags.Instance);
				}

				add_type_forwarder.Invoke (builder, new object[] { type.GetMetaInfo () });
			} catch {
				ctx.Report.RuntimeMissingSupport (loc, "TypeForwardedToAttribute");
			}
		}
開發者ID:Tak,項目名稱:monodevelop-novell,代碼行數:12,代碼來源:assembly.cs

示例4: ContainsGenericParameters

	// TODO: Implement correctly
	public static bool ContainsGenericParameters (TypeSpec type)
	{
		return type.GetMetaInfo ().ContainsGenericParameters;
	}
開發者ID:telurmasin,項目名稱:mono,代碼行數:5,代碼來源:typemanager.cs

示例5: EmitStoreFromPtr

		//
		// The stack contains the pointer and the value of type `type'
		//
		public void EmitStoreFromPtr (TypeSpec type)
		{
			if (type.IsEnum)
				type = EnumSpec.GetUnderlyingType (type);

			if (type == TypeManager.int32_type || type == TypeManager.uint32_type)
				ig.Emit (OpCodes.Stind_I4);
			else if (type == TypeManager.int64_type || type == TypeManager.uint64_type)
				ig.Emit (OpCodes.Stind_I8);
			else if (type == TypeManager.char_type || type == TypeManager.short_type ||
				 type == TypeManager.ushort_type)
				ig.Emit (OpCodes.Stind_I2);
			else if (type == TypeManager.float_type)
				ig.Emit (OpCodes.Stind_R4);
			else if (type == TypeManager.double_type)
				ig.Emit (OpCodes.Stind_R8);
			else if (type == TypeManager.byte_type || type == TypeManager.sbyte_type ||
				 type == TypeManager.bool_type)
				ig.Emit (OpCodes.Stind_I1);
			else if (type == TypeManager.intptr_type)
				ig.Emit (OpCodes.Stind_I);
			else if (TypeManager.IsStruct (type) || TypeManager.IsGenericParameter (type))
				ig.Emit (OpCodes.Stobj, type.GetMetaInfo ());
			else
				ig.Emit (OpCodes.Stind_Ref);
		}
開發者ID:kumpera,項目名稱:mono,代碼行數:29,代碼來源:codegen.cs

示例6: BeginCatchBlock

		public void BeginCatchBlock (TypeSpec type)
		{
			ig.BeginCatchBlock (type.GetMetaInfo ());
		}
開發者ID:KAW0,項目名稱:Alter-Native,代碼行數:4,代碼來源:codegen.cs

示例7: EncodeTypeName

		public void EncodeTypeName (TypeSpec type)
		{
			var old_type = type.GetMetaInfo ();
			Encode (type.MemberDefinition.IsImported ? old_type.AssemblyQualifiedName : old_type.FullName);
		}
開發者ID:alisci01,項目名稱:mono,代碼行數:5,代碼來源:attribute.cs

示例8: GetReferenceType

 //
 // Gets the reference to T version of the Type (T&)
 //
 public static Type GetReferenceType(TypeSpec t)
 {
     return t.GetMetaInfo ().MakeByRefType ();
 }
開發者ID:speier,項目名稱:shake,代碼行數:7,代碼來源:typemanager.cs

示例9: DeclareLocal

		public LocalBuilder DeclareLocal (TypeSpec type, bool pinned)
		{
			if (IsAnonymousStoreyMutateRequired)
				type = CurrentAnonymousMethod.Storey.Mutator.Mutate (type);

			if (pinned) {
				//
				// This is for .net compatibility. I am not sure why pinned
				// pointer temps are converted to & even if they are pointers to
				// pointers.
				//
				var pt = type as PointerContainer;
				if (pt != null) {
					type = pt.Element;
					if (type.Kind == MemberKind.Void)
						type = Module.Compiler.BuiltinTypes.IntPtr;
					
					return ig.DeclareLocal (type.GetMetaInfo ().MakeByRefType (), true);
				}
			}

			return ig.DeclareLocal (type.GetMetaInfo (), pinned);
		}
開發者ID:ItsVeryWindy,項目名稱:mono,代碼行數:23,代碼來源:codegen.cs

示例10: GetSignatureForDoc

		static string GetSignatureForDoc (TypeSpec type)
		{
			var tp = type as TypeParameterSpec;
			if (tp != null) {
				int c = 0;
				type = type.DeclaringType;
				while (type != null && type.DeclaringType != null) {
					type = type.DeclaringType;
					c += type.MemberDefinition.TypeParametersCount;
				}
				var prefix = tp.IsMethodOwned ? "``" : "`";
				return prefix + (c + tp.DeclaredPosition);
			}

			var pp = type as PointerContainer;
			if (pp != null)
				return GetSignatureForDoc (pp.Element) + "*";

			ArrayContainer ap = type as ArrayContainer;
			if (ap != null)
				return GetSignatureForDoc (ap.Element) +
					ArrayContainer.GetPostfixSignature (ap.Rank);

			if (TypeManager.IsGenericType (type)) {
				string g = type.MemberDefinition.Namespace;
				if (g != null && g.Length > 0)
					g += '.';
				int idx = type.Name.LastIndexOf ('`');
				g += (idx < 0 ? type.Name : type.Name.Substring (0, idx)) + '{';
				int argpos = 0;
				foreach (TypeSpec t in TypeManager.GetTypeArguments (type))
					g += (argpos++ > 0 ? "," : String.Empty) + GetSignatureForDoc (t);
				g += '}';
				return g;
			}

			string name = type.GetMetaInfo ().FullName != null ? type.GetMetaInfo ().FullName : type.Name;
			return name.Replace ("+", ".").Replace ('&', '@');
		}
開發者ID:Ein,項目名稱:monodevelop,代碼行數:39,代碼來源:doc.cs

示例11: ExactInference

		//
		// 26.3.3.8 Exact Inference
		//
		public int ExactInference (TypeSpec u, TypeSpec v)
		{
			// If V is an array type
			if (v.IsArray) {
				if (!u.IsArray)
					return 0;

				// TODO MemberCache: GetMetaInfo ()
				if (u.GetMetaInfo ().GetArrayRank () != v.GetMetaInfo ().GetArrayRank ())
					return 0;

				return ExactInference (TypeManager.GetElementType (u), TypeManager.GetElementType (v));
			}

			// If V is constructed type and U is constructed type
			if (TypeManager.IsGenericType (v)) {
				if (!TypeManager.IsGenericType (u))
					return 0;

				TypeSpec [] ga_u = TypeManager.GetTypeArguments (u);
				TypeSpec [] ga_v = TypeManager.GetTypeArguments (v);
				if (ga_u.Length != ga_v.Length)
					return 0;

				int score = 0;
				for (int i = 0; i < ga_u.Length; ++i)
					score += ExactInference (ga_u [i], ga_v [i]);

				return score > 0 ? 1 : 0;
			}

			// If V is one of the unfixed type arguments
			int pos = IsUnfixed (v);
			if (pos == -1)
				return 0;

			AddToBounds (new BoundInfo (u, BoundKind.Exact), pos);
			return 1;
		}
開發者ID:ikvm,項目名稱:mono,代碼行數:42,代碼來源:generic.cs

示例12: EmitLoadFromPtr

		//
		// Load the object from the pointer.  
		//
		public void EmitLoadFromPtr (TypeSpec type)
		{
			if (type.Kind == MemberKind.Enum)
				type = EnumSpec.GetUnderlyingType (type);

			switch (type.BuiltinType) {
			case BuiltinTypeSpec.Type.Int:
				ig.Emit (OpCodes.Ldind_I4);
				break;
			case BuiltinTypeSpec.Type.UInt:
				ig.Emit (OpCodes.Ldind_U4);
				break;
			case BuiltinTypeSpec.Type.Short:
				ig.Emit (OpCodes.Ldind_I2);
				break;
			case BuiltinTypeSpec.Type.UShort:
			case BuiltinTypeSpec.Type.Char:
				ig.Emit (OpCodes.Ldind_U2);
				break;
			case BuiltinTypeSpec.Type.Byte:
				ig.Emit (OpCodes.Ldind_U1);
				break;
			case BuiltinTypeSpec.Type.SByte:
			case BuiltinTypeSpec.Type.Bool:
				ig.Emit (OpCodes.Ldind_I1);
				break;
			case BuiltinTypeSpec.Type.ULong:
			case BuiltinTypeSpec.Type.Long:
				ig.Emit (OpCodes.Ldind_I8);
				break;
			case BuiltinTypeSpec.Type.Float:
				ig.Emit (OpCodes.Ldind_R4);
				break;
			case BuiltinTypeSpec.Type.Double:
				ig.Emit (OpCodes.Ldind_R8);
				break;
			case BuiltinTypeSpec.Type.IntPtr:
				ig.Emit (OpCodes.Ldind_I);
				break;
			default:
				switch (type.Kind) {
				case MemberKind.Struct:
				case MemberKind.TypeParameter:
					if (IsAnonymousStoreyMutateRequired)
						type = CurrentAnonymousMethod.Storey.Mutator.Mutate (type);

					ig.Emit (OpCodes.Ldobj, type.GetMetaInfo ());
					break;
				case MemberKind.PointerType:
					ig.Emit (OpCodes.Ldind_I);
					break;
				default:
					ig.Emit (OpCodes.Ldind_Ref);
					break;
				}
				break;
			}

			if (TrackStackTypes) {
				// TODO: test for async when `this' can be used inside structs
				SetStackType (type);
			}
		}
開發者ID:ccflo,項目名稱:mono,代碼行數:66,代碼來源:codegen.cs

示例13: Emit

		public void Emit (OpCode opcode, TypeSpec type)
		{
			if (IsAnonymousStoreyMutateRequired)
				type = CurrentAnonymousMethod.Storey.Mutator.Mutate (type);

			ig.Emit (opcode, type.GetMetaInfo ());

			if (TrackStackTypes) {
				switch (opcode.StackBehaviourPush) {
				case StackBehaviour.Push0:
					// Nothing
					break;
				case StackBehaviour.Pushi:
					SetStackType (ReferenceContainer.MakeType (Module, type));
					break;
				case StackBehaviour.Push1:
					SetStackType (type);
					break;
				default:
					if (opcode == OpCodes.Box) {
						SetStackType (Module.Compiler.BuiltinTypes.Object);
					} else if (opcode == OpCodes.Castclass) {
						SetStackType (type);
					} else {
						throw new NotImplementedException (opcode.Name);
					}
					break;
				}
			}
		}
開發者ID:ccflo,項目名稱:mono,代碼行數:30,代碼來源:codegen.cs

示例14: Emit

		public void Emit (OpCode opcode, TypeSpec type)
		{
			if (IsAnonymousStoreyMutateRequired)
				type = CurrentAnonymousMethod.Storey.Mutator.Mutate (type);

			ig.Emit (opcode, type.GetMetaInfo ());
		}
開發者ID:blinds52,項目名稱:mono,代碼行數:7,代碼來源:codegen.cs

示例15: GetSignatureForDoc

        static string GetSignatureForDoc(TypeSpec type)
        {
            var tp = type as TypeParameterSpec;
            if (tp != null) {
                var prefix = tp.IsMethodOwned ? "``" : "`";
                return prefix + tp.DeclaredPosition;
            }

            if (TypeManager.IsGenericType (type)) {
                string g = type.MemberDefinition.Namespace;
                if (g != null && g.Length > 0)
                    g += '.';
                int idx = type.Name.LastIndexOf ('`');
                g += (idx < 0 ? type.Name : type.Name.Substring (0, idx)) + '{';
                int argpos = 0;
                foreach (TypeSpec t in TypeManager.GetTypeArguments (type))
                    g += (argpos++ > 0 ? "," : String.Empty) + GetSignatureForDoc (t);
                g += '}';
                return g;
            }

            string name = type.GetMetaInfo ().FullName != null ? type.GetMetaInfo ().FullName : type.Name;
            return name.Replace ("+", ".").Replace ('&', '@');
        }
開發者ID:speier,項目名稱:shake,代碼行數:24,代碼來源:doc.cs


注:本文中的System.TypeSpec.GetMetaInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。