Mono.CSharp.MethodSpec.GetSignatureForError C# (CSharp) Method

GetSignatureForError() public method

public GetSignatureForError ( ) : string
return string
        public override string GetSignatureForError()
        {
            string name;
            if (IsConstructor) {
                name = DeclaringType.GetSignatureForError () + "." + DeclaringType.Name;
            } else if (Kind == MemberKind.Operator) {
                var op = Operator.GetType (Name).Value;
                if (op == Operator.OpType.Implicit || op == Operator.OpType.Explicit) {
                    name = DeclaringType.GetSignatureForError () + "." + Operator.GetName (op) + " operator " + returnType.GetSignatureForError ();
                } else {
                    name = DeclaringType.GetSignatureForError () + ".operator " + Operator.GetName (op);
                }
            } else if (IsAccessor) {
                int split = Name.IndexOf ('_');
                name = Name.Substring (split + 1);
                var postfix = Name.Substring (0, split);
                if (split == 3) {
                    var pc = parameters.Count;
                    if (pc > 0 && postfix == "get") {
                        name = "this" + parameters.GetSignatureForError ("[", "]", pc);
                    } else if (pc > 1 && postfix == "set") {
                        name = "this" + parameters.GetSignatureForError ("[", "]", pc - 1);
                    }
                }

                return DeclaringType.GetSignatureForError () + "." + name + "." + postfix;
            } else {
                name = base.GetSignatureForError ();
                if (targs != null)
                    name += "<" + TypeManager.CSharpName (targs) + ">";
                else if (IsGeneric)
                    name += "<" + TypeManager.CSharpName (GenericDefinition.TypeParameters) + ">";
            }

            return name + parameters.GetSignatureForError ();
        }

Usage Example

Example #1
0
		public static bool CheckImplementingMethodConstraints (TypeContainer container, MethodSpec method, MethodSpec baseMethod)
		{
			var tparams = method.Constraints;
			var base_tparams = baseMethod.Constraints;
			for (int i = 0; i < tparams.Length; ++i) {
				if (!tparams[i].HasSameConstraintsImplementation (base_tparams[i])) {
					container.Compiler.Report.SymbolRelatedToPreviousError (method);
					container.Compiler.Report.SymbolRelatedToPreviousError (baseMethod);

					// Using container location because the interface can be implemented
					// by base class
					container.Compiler.Report.Error (425, container.Location,
						"The constraints for type parameter `{0}' of method `{1}' must match the constraints for type parameter `{2}' of interface method `{3}'. Consider using an explicit interface implementation instead",
						tparams[i].GetSignatureForError (), method.GetSignatureForError (),
						base_tparams[i].GetSignatureForError (), baseMethod.GetSignatureForError ());
 
					return false;
				}
			}

			return true;
		}
All Usage Examples Of Mono.CSharp.MethodSpec::GetSignatureForError