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


C# MemberSpec.GetSignatureForError方法代码示例

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


在下文中一共展示了MemberSpec.GetSignatureForError方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Error_CannotChangeAccessModifiers

		protected void Error_CannotChangeAccessModifiers (MemberCore member, MemberSpec base_member)
		{
			var base_modifiers = base_member.Modifiers;

			// Remove internal modifier from types which are not internally accessible
			if ((base_modifiers & Modifiers.AccessibilityMask) == (Modifiers.PROTECTED | Modifiers.INTERNAL) &&
				!base_member.DeclaringType.MemberDefinition.IsInternalAsPublic (member.Module.DeclaringAssembly))
				base_modifiers = Modifiers.PROTECTED;

			Report.SymbolRelatedToPreviousError (base_member);
			Report.Error (507, member.Location,
				"`{0}': cannot change access modifiers when overriding `{1}' inherited member `{2}'",
				member.GetSignatureForError (),
				ModifiersExtensions.AccessibilityName (base_modifiers),
				base_member.GetSignatureForError ());
		}
开发者ID:fvalette,项目名称:mono,代码行数:16,代码来源:class.cs

示例2: CSharpSignature

	static public string CSharpSignature (MemberSpec mb)
	{
		return mb.GetSignatureForError ();
	}
开发者ID:telurmasin,项目名称:mono,代码行数:4,代码来源:typemanager.cs

示例3: CheckOverrideAgainstBase

		//
		// Performs various checks on the MethodInfo `mb' regarding the modifier flags
		// that have been defined.
		//
		protected virtual bool CheckOverrideAgainstBase (MemberSpec base_member)
		{
			bool ok = true;

			if ((base_member.Modifiers & (Modifiers.ABSTRACT | Modifiers.VIRTUAL | Modifiers.OVERRIDE)) == 0) {
				Report.SymbolRelatedToPreviousError (base_member);
				Report.Error (506, Location,
					"`{0}': cannot override inherited member `{1}' because it is not marked virtual, abstract or override",
					 GetSignatureForError (), TypeManager.CSharpSignature (base_member));
				ok = false;
			}

			// Now we check that the overriden method is not final	
			if ((base_member.Modifiers & Modifiers.SEALED) != 0) {
				Report.SymbolRelatedToPreviousError (base_member);
				Report.Error (239, Location, "`{0}': cannot override inherited member `{1}' because it is sealed",
							  GetSignatureForError (), TypeManager.CSharpSignature (base_member));
				ok = false;
			}

			var base_member_type = ((IInterfaceMemberSpec) base_member).MemberType;
			if (!TypeSpecComparer.Override.IsEqual (MemberType, base_member_type)) {
				Report.SymbolRelatedToPreviousError (base_member);
				if (this is PropertyBasedMember) {
					Report.Error (1715, Location, "`{0}': type must be `{1}' to match overridden member `{2}'",
						GetSignatureForError (), base_member_type.GetSignatureForError (), base_member.GetSignatureForError ());
				} else {
					Report.Error (508, Location, "`{0}': return type must be `{1}' to match overridden member `{2}'",
						GetSignatureForError (), base_member_type.GetSignatureForError (), base_member.GetSignatureForError ());
				}
				ok = false;
			}

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

示例4:

			bool OverloadResolver.IErrorHandler.AmbiguousCandidates (ResolveContext ec, MemberSpec best, MemberSpec ambiguous)
			{
				ec.Report.SymbolRelatedToPreviousError (best);
				ec.Report.Warning (278, 2, loc,
					"`{0}' contains ambiguous implementation of `{1}' pattern. Method `{2}' is ambiguous with method `{3}'",
					expr.Type.GetSignatureForError (), "enumerable",
					best.GetSignatureForError (), ambiguous.GetSignatureForError ());

				ambiguous_getenumerator_name = true;
				return true;
			}
开发者ID:alisci01,项目名称:mono,代码行数:11,代码来源:statement.cs

示例5: GetFullNameSignature

	static public string GetFullNameSignature (MemberSpec mi)
	{
		return mi.GetSignatureForError ();
	}
开发者ID:telurmasin,项目名称:mono,代码行数:4,代码来源:typemanager.cs

示例6: Error_CannotChangeAccessModifiers

		protected void Error_CannotChangeAccessModifiers (MemberCore member, MemberSpec base_member)
		{
			Report.SymbolRelatedToPreviousError (base_member);
			Report.Error (507, member.Location,
				"`{0}': cannot change access modifiers when overriding `{1}' inherited member `{2}'",
				member.GetSignatureForError (),
				ModifiersExtensions.AccessibilityName (base_member.Modifiers),
				base_member.GetSignatureForError ());
		}
开发者ID:pgoron,项目名称:monodevelop,代码行数:9,代码来源:class.cs

示例7: Error_CannotAccessProtected

 protected static void Error_CannotAccessProtected(ResolveContext ec, Location loc, MemberSpec m, TypeSpec qualifier, TypeSpec container)
 {
     ec.Report.Error (1540, loc, "Cannot access protected member `{0}' via a qualifier of type `{1}'."
         + " The qualifier must be of type `{2}' or derived from it",
         m.GetSignatureForError (),
         TypeManager.CSharpName (qualifier),
         TypeManager.CSharpName (container));
 }
开发者ID:speier,项目名称:shake,代码行数:8,代码来源:ecore.cs

示例8: Error_TypeArgumentsCannotBeUsed

        public void Error_TypeArgumentsCannotBeUsed(Report report, Location loc, MemberSpec member, int arity)
        {
            // Better message for possible generic expressions
            if (member != null && (member.Kind & MemberKind.GenericMask) != 0) {
                report.SymbolRelatedToPreviousError (member);
                if (member is TypeSpec)
                    member = ((TypeSpec) member).GetDefinition ();
                else
                    member = ((MethodSpec) member).GetGenericMethodDefinition ();

                string name = member.Kind == MemberKind.Method ? "method" : "type";
                if (member.IsGeneric) {
                    report.Error (305, loc, "Using the generic {0} `{1}' requires `{2}' type argument(s)",
                        name, member.GetSignatureForError (), member.Arity.ToString ());
                } else {
                    report.Error (308, loc, "The non-generic {0} `{1}' cannot be used with the type arguments",
                        name, member.GetSignatureForError ());
                }
            } else {
                report.Error (307, loc, "The {0} `{1}' cannot be used with type arguments",
                    ExprClassName, GetSignatureForError ());
            }
        }
开发者ID:speier,项目名称:shake,代码行数:23,代码来源:ecore.cs

示例9: CheckConversion

		static void CheckConversion (IMemberContext mc, MemberSpec context, TypeSpec atype, TypeParameterSpec tparam, TypeSpec ttype, Location loc)
		{
			var expr = new EmptyExpression (atype);
			if (!Convert.ImplicitStandardConversionExists (expr, ttype)) {
				mc.Compiler.Report.SymbolRelatedToPreviousError (tparam);
				if (TypeManager.IsValueType (atype)) {
					mc.Compiler.Report.Error (315, loc, "The type `{0}' cannot be used as type parameter `{1}' in the generic type or method `{2}'. There is no boxing conversion from `{0}' to `{3}'",
						atype.GetSignatureForError (), tparam.GetSignatureForError (), context.GetSignatureForError (), ttype.GetSignatureForError ());
				} else if (atype.IsGenericParameter) {
					mc.Compiler.Report.Error (314, loc, "The type `{0}' cannot be used as type parameter `{1}' in the generic type or method `{2}'. There is no boxing or type parameter conversion from `{0}' to `{3}'",
						atype.GetSignatureForError (), tparam.GetSignatureForError (), context.GetSignatureForError (), ttype.GetSignatureForError ());
				} else {
					mc.Compiler.Report.Error (311, loc, "The type `{0}' cannot be used as type parameter `{1}' in the generic type or method `{2}'. There is no implicit reference conversion from `{0}' to `{3}'",
						atype.GetSignatureForError (), tparam.GetSignatureForError (), context.GetSignatureForError (), ttype.GetSignatureForError ());
				}
			}
		}
开发者ID:ikvm,项目名称:mono,代码行数:17,代码来源:generic.cs

示例10: CheckConstraint

		static bool CheckConstraint (IMemberContext mc, MemberSpec context, TypeSpec atype, TypeParameterSpec tparam, Location loc)
		{
			//
			// First, check the `class' and `struct' constraints.
			//
			if (tparam.HasSpecialClass && !TypeManager.IsReferenceType (atype)) {
				mc.Compiler.Report.Error (452, loc,
					"The type `{0}' must be a reference type in order to use it as type parameter `{1}' in the generic type or method `{2}'",
					TypeManager.CSharpName (atype), tparam.GetSignatureForError (), context.GetSignatureForError ());
				return false;
			}

			if (tparam.HasSpecialStruct && (!TypeManager.IsValueType (atype) || TypeManager.IsNullableType (atype))) {
				mc.Compiler.Report.Error (453, loc,
					"The type `{0}' must be a non-nullable value type in order to use it as type parameter `{1}' in the generic type or method `{2}'",
					TypeManager.CSharpName (atype), tparam.GetSignatureForError (), context.GetSignatureForError ());
				return false;
			}

			//
			// The class constraint comes next.
			//
			if (tparam.HasTypeConstraint) {
				CheckConversion (mc, context, atype, tparam, tparam.BaseType, loc);
			}

			//
			// Now, check the interfaces and type parameters constraints
			//
			if (tparam.Interfaces != null) {
				if (TypeManager.IsNullableType (atype)) {
					mc.Compiler.Report.Error (313, loc,
						"The type `{0}' cannot be used as type parameter `{1}' in the generic type or method `{2}'. The nullable type `{0}' never satisfies interface constraint",
						atype.GetSignatureForError (), tparam.GetSignatureForError (), context.GetSignatureForError ());
				} else {
					foreach (TypeSpec iface in tparam.Interfaces) {
						CheckConversion (mc, context, atype, tparam, iface, loc);
					}
				}
			}

			//
			// Finally, check the constructor constraint.
			//
			if (!tparam.HasSpecialConstructor)
				return true;

			if (!HasDefaultConstructor (atype)) {
				mc.Compiler.Report.SymbolRelatedToPreviousError (atype);
				mc.Compiler.Report.Error (310, loc,
					"The type `{0}' must have a public parameterless constructor in order to use it as parameter `{1}' in the generic type or method `{2}'",
					TypeManager.CSharpName (atype), tparam.GetSignatureForError (), context.GetSignatureForError ());
				return false;
			}

			return true;
		}
开发者ID:ikvm,项目名称:mono,代码行数:57,代码来源:generic.cs


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