当前位置: 首页>>代码示例>>C#>>正文


C# CSharp.TypeDefinition类代码示例

本文整理汇总了C#中Mono.CSharp.TypeDefinition的典型用法代码示例。如果您正苦于以下问题:C# TypeDefinition类的具体用法?C# TypeDefinition怎么用?C# TypeDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypeDefinition类属于Mono.CSharp命名空间,在下文中一共展示了TypeDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Event

        protected Event(TypeDefinition parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, Attributes attrs)
            : base(parent, type, mod_flags,
				parent.PartialContainer.Kind == MemberKind.Interface ? AllowedModifiersInterface :
				parent.PartialContainer.Kind == MemberKind.Struct ? AllowedModifiersStruct :
				AllowedModifiersClass,
				name, attrs)
        {
        }
开发者ID:segaman,项目名称:NRefactory,代码行数:8,代码来源:property.cs

示例2: PropertyBase

		public PropertyBase (TypeDefinition parent, FullNamedExpression type, Modifiers mod_flags, Modifiers allowed_mod, MemberName name, Attributes attrs)
			: base (parent, type, mod_flags, allowed_mod, name, attrs)
		{
		}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:4,代码来源:property.cs

示例3: AnonymousMethodMethod

			public AnonymousMethodMethod (TypeDefinition parent, AnonymousExpression am, AnonymousMethodStorey storey,
							  TypeExpr return_type,
							  Modifiers mod, MemberName name,
							  ParametersCompiled parameters)
				: base (parent, return_type, mod | Modifiers.COMPILER_GENERATED,
						name, parameters, null)
			{
				this.AnonymousMethod = am;
				this.Storey = storey;

				Parent.PartialContainer.Members.Add (this);
				Block = new ToplevelBlock (am.block, parameters);
			}
开发者ID:rabink,项目名称:mono,代码行数:13,代码来源:anonymous.cs

示例4: MemberBase

		protected MemberBase (TypeDefinition parent, FullNamedExpression type, Modifiers mod, Modifiers allowed_mod, Modifiers def_mod, MemberName name, Attributes attrs)
			: base (parent, name, attrs)
		{
			this.Parent = parent;
			this.type_expr = type;

			if (name != MemberName.Null)
				ModFlags = ModifiersExtensions.Check (allowed_mod, mod, def_mod, Location, Report);
		}
开发者ID:fvalette,项目名称:mono,代码行数:9,代码来源:class.cs

示例5: CheckRecursiveDefinition

		TypeSpec CheckRecursiveDefinition (TypeDefinition tc)
		{
			if (InTransit != null)
				return spec;

			InTransit = tc;

			if (base_type != null) {
				var ptc = base_type.MemberDefinition as TypeDefinition;
				if (ptc != null && ptc.CheckRecursiveDefinition (this) != null)
					return base_type;
			}

			if (iface_exprs != null) {
				foreach (var iface in iface_exprs) {
					// the interface might not have been resolved, prevents a crash, see #442144
					if (iface == null)
						continue;
					var ptc = iface.MemberDefinition as Interface;
					if (ptc != null && ptc.CheckRecursiveDefinition (this) != null)
						return iface;
				}
			}

			if (!IsTopLevel && Parent.PartialContainer.CheckRecursiveDefinition (this) != null)
				return spec;

			InTransit = null;
			return null;
		}
开发者ID:fvalette,项目名称:mono,代码行数:30,代码来源:class.cs

示例6: AddPartial

		public virtual void AddPartial (TypeDefinition next_part)
		{
			MemberCore mc;
			(PartialContainer ?? this).defined_names.TryGetValue (next_part.Basename, out mc);

			AddPartial (next_part, mc as TypeDefinition);
		}
开发者ID:fvalette,项目名称:mono,代码行数:7,代码来源:class.cs

示例7: Create

		public static Method Create (TypeDefinition parent, FullNamedExpression returnType, Modifiers mod,
				   MemberName name, ParametersCompiled parameters, Attributes attrs)
		{
			var m = new Method (parent, returnType, mod, name, parameters, attrs);

			if ((mod & Modifiers.PARTIAL) != 0) {
				const Modifiers invalid_partial_mod = Modifiers.AccessibilityMask | Modifiers.ABSTRACT | Modifiers.EXTERN |
					Modifiers.NEW | Modifiers.OVERRIDE | Modifiers.SEALED | Modifiers.VIRTUAL;

				if ((mod & invalid_partial_mod) != 0) {
					m.Report.Error (750, m.Location,
						"A partial method cannot define access modifier or any of abstract, extern, new, override, sealed, or virtual modifiers");
					mod &= ~invalid_partial_mod;
				}

				if ((parent.ModFlags & Modifiers.PARTIAL) == 0) {
					m.Report.Error (751, m.Location, 
						"A partial method must be declared within a partial class or partial struct");
				}
			}

			if ((mod & Modifiers.STATIC) == 0 && parameters.HasExtensionMethodType) {
				m.Report.Error (1105, m.Location, "`{0}': Extension methods must be declared static",
					m.GetSignatureForError ());
			}


			return m;
		}
开发者ID:OpenFlex,项目名称:playscript-mono,代码行数:29,代码来源:method.cs

示例8: Method

		public Method (TypeDefinition parent, FullNamedExpression return_type, Modifiers mod, MemberName name, ParametersCompiled parameters, Attributes attrs)
			: base (parent, return_type, mod,
				parent.PartialContainer.Kind == MemberKind.Interface ? AllowedModifiersInterface :
				parent.PartialContainer.Kind == MemberKind.Struct ? AllowedModifiersStruct | Modifiers.ASYNC :
				AllowedModifiersClass | Modifiers.ASYNC,
				name, attrs, parameters)
		{
		}
开发者ID:OpenFlex,项目名称:playscript-mono,代码行数:8,代码来源:method.cs

示例9: DefineOverride

		public void DefineOverride (TypeDefinition container)
		{
			if (implementing == null)
				return;

			if (!member.IsExplicitImpl)
				return;

			container.TypeBuilder.DefineMethodOverride (builder, (MethodInfo) implementing.GetMetaInfo ());
		}
开发者ID:OpenFlex,项目名称:playscript-mono,代码行数:10,代码来源:method.cs

示例10: Define

		public bool Define (TypeDefinition container, string method_full_name)
		{
			PendingImplementation pending = container.PendingImplementations;
			MethodSpec ambig_iface_method;
			bool optional = false;

			if (pending != null) {
				implementing = pending.IsInterfaceMethod (method.MethodName, member.InterfaceType, this, out ambig_iface_method, ref optional);

				if (member.InterfaceType != null) {
					if (implementing == null) {
						if (member is PropertyBase) {
							container.Compiler.Report.Error (550, method.Location,
								"`{0}' is an accessor not found in interface member `{1}{2}'",
									  method.GetSignatureForError (), member.InterfaceType.GetSignatureForError (),
									  member.GetSignatureForError ().Substring (member.GetSignatureForError ().LastIndexOf ('.')));

						} else {
							container.Compiler.Report.Error (539, method.Location,
									  "`{0}.{1}' in explicit interface declaration is not a member of interface",
									  member.InterfaceType.GetSignatureForError (), member.ShortName);
						}
						return false;
					}
					if (implementing.IsAccessor && !method.IsAccessor) {
						container.Compiler.Report.SymbolRelatedToPreviousError (implementing);
						container.Compiler.Report.Error (683, method.Location,
							"`{0}' explicit method implementation cannot implement `{1}' because it is an accessor",
							member.GetSignatureForError (), implementing.GetSignatureForError ());
						return false;
					}
				} else {
					if (implementing != null) {
						if (!method.IsAccessor) {
							if (implementing.IsAccessor) {
								container.Compiler.Report.SymbolRelatedToPreviousError (implementing);
								container.Compiler.Report.Error (470, method.Location,
									"Method `{0}' cannot implement interface accessor `{1}'",
									method.GetSignatureForError (), TypeManager.CSharpSignature (implementing));
							}
						} else if (implementing.DeclaringType.IsInterface) {
							if (!implementing.IsAccessor) {
								container.Compiler.Report.SymbolRelatedToPreviousError (implementing);
								container.Compiler.Report.Error (686, method.Location,
									"Accessor `{0}' cannot implement interface member `{1}' for type `{2}'. Use an explicit interface implementation",
									method.GetSignatureForError (), TypeManager.CSharpSignature (implementing), container.GetSignatureForError ());
							} else {
								PropertyBase.PropertyMethod pm = method as PropertyBase.PropertyMethod;
								if (pm != null && pm.HasCustomAccessModifier && (pm.ModFlags & Modifiers.PUBLIC) == 0) {
									container.Compiler.Report.SymbolRelatedToPreviousError (implementing);
									container.Compiler.Report.Error (277, method.Location,
										"Accessor `{0}' must be declared public to implement interface member `{1}'",
										method.GetSignatureForError (), implementing.GetSignatureForError ());
								}
							}
						}
					}
				}
			} else {
				ambig_iface_method = null;
			}

			//
			// For implicit implementations, make sure we are public, for
			// explicit implementations, make sure we are private.
			//
			if (implementing != null){
				if (member.IsExplicitImpl) {
					if (method.ParameterInfo.HasParams && !implementing.Parameters.HasParams) {
						container.Compiler.Report.SymbolRelatedToPreviousError (implementing);
						container.Compiler.Report.Error (466, method.Location,
							"`{0}': the explicit interface implementation cannot introduce the params modifier",
							method.GetSignatureForError ());
					}

					if (ambig_iface_method != null) {
						container.Compiler.Report.SymbolRelatedToPreviousError (ambig_iface_method);
						container.Compiler.Report.SymbolRelatedToPreviousError (implementing);
						container.Compiler.Report.Warning (473, 2, method.Location,
							"Explicit interface implementation `{0}' matches more than one interface member. Consider using a non-explicit implementation instead",
							method.GetSignatureForError ());
					}
				} else {
					//
					// Setting implementin to null inside this block will trigger a more
					// verbose error reporting for missing interface implementations
					//
					if (implementing.DeclaringType.IsInterface) {
						//
						// If this is an interface method implementation,
						// check for public accessibility
						//
						if ((flags & MethodAttributes.MemberAccessMask) != MethodAttributes.Public) {
							implementing = null;
						} else if (optional && (container.Interfaces == null || !container.Definition.Interfaces.Contains (implementing.DeclaringType))) {
							//
							// We are not implementing interface when base class already implemented it
							//
							implementing = null;
						}
//.........这里部分代码省略.........
开发者ID:OpenFlex,项目名称:playscript-mono,代码行数:101,代码来源:method.cs

示例11: Constructor

		public Constructor (TypeDefinition parent, string name, Modifiers mod, Attributes attrs, ParametersCompiled args, Location loc)
			: base (parent, null, mod, AllowedModifiers, new MemberName (name, loc), attrs, args)
		{
		}
开发者ID:OpenFlex,项目名称:playscript-mono,代码行数:4,代码来源:method.cs

示例12: AddTypeContainer

		public void AddTypeContainer (TypeContainer current_container, TypeDefinition tc)
		{
			if (current_container == tc){
				Console.Error.WriteLine ("Internal error: inserting container into itself");
				return;
			}

			if (undo_actions == null)
				undo_actions = new List<Action> ();

			var existing = current_container.Containers.FirstOrDefault (l => l.Basename == tc.Basename);
			if (existing != null) {
				current_container.RemoveContainer (existing);
				undo_actions.Add (() => current_container.AddTypeContainer (existing));
			}

			undo_actions.Add (() => current_container.RemoveContainer (tc));
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:18,代码来源:eval.cs

示例13: InteractiveMethod

		public InteractiveMethod(TypeDefinition parent, FullNamedExpression returnType, Modifiers mod, ParametersCompiled parameters)
			: base(parent, returnType, mod, new MemberName("Host"), parameters, null)
		{
		}
开发者ID:FrancisVarga,项目名称:mono,代码行数:4,代码来源:eval.cs

示例14: Emit

			public override void Emit (TypeDefinition parent)
			{
				if ((method.ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) == 0 && !Compiler.Settings.WriteMetadataOnly) {
					block = new ToplevelBlock (Compiler, ParameterInfo, Location) {
						IsCompilerGenerated = true
					};
					FabricateBodyStatement ();
				}

				base.Emit (parent);
			}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:11,代码来源:property.cs

示例15: EventProperty

		public EventProperty (TypeDefinition parent, FullNamedExpression type, Modifiers mod_flags, MemberName name, Attributes attrs)
			: base (parent, type, mod_flags, name, attrs)
		{
		}
开发者ID:bbqchickenrobot,项目名称:playscript-mono,代码行数:4,代码来源:property.cs


注:本文中的Mono.CSharp.TypeDefinition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。