GetFullNameSignature() static public méthode

static public GetFullNameSignature ( MemberSpec mi ) : string
mi MemberSpec
Résultat string
Exemple #1
0
        void Error_ConversionFailed(ResolveContext ec, MethodSpec method, Expression return_type)
        {
            var    invoke_method = Delegate.GetInvokeMethod(type);
            string member_name   = method_group.InstanceExpression != null?
                                   Delegate.FullDelegateDesc(method) :
                                       TypeManager.GetFullNameSignature(method);

            ec.Report.SymbolRelatedToPreviousError(type);
            ec.Report.SymbolRelatedToPreviousError(method);
            if (ec.Module.Compiler.Settings.Version == LanguageVersion.ISO_1)
            {
                ec.Report.Error(410, loc, "A method or delegate `{0} {1}' parameters and return type must be same as delegate `{2} {3}' parameters and return type",
                                method.ReturnType.GetSignatureForError(), member_name,
                                invoke_method.ReturnType.GetSignatureForError(), Delegate.FullDelegateDesc(invoke_method));
                return;
            }

            if (return_type == null)
            {
                ec.Report.Error(123, loc, "A method or delegate `{0}' parameters do not match delegate `{1}' parameters",
                                member_name, Delegate.FullDelegateDesc(invoke_method));
                return;
            }

            ec.Report.Error(407, loc, "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' return type",
                            return_type.GetSignatureForError(), member_name,
                            invoke_method.ReturnType.GetSignatureForError(), Delegate.FullDelegateDesc(invoke_method));
        }
Exemple #2
0
        void Error_ConversionFailed(ResolveContext ec, MethodBase method, Expression return_type)
        {
            MethodInfo invoke_method = Delegate.GetInvokeMethod(ec.Compiler, ec.CurrentType, type);
            string     member_name   = delegate_instance_expression != null?
                                       Delegate.FullDelegateDesc(method) :
                                           TypeManager.GetFullNameSignature(method);

            ec.Report.SymbolRelatedToPreviousError(type);
            ec.Report.SymbolRelatedToPreviousError(method);
            if (RootContext.Version == LanguageVersion.ISO_1)
            {
                ec.Report.Error(410, loc, "A method or delegate `{0} {1}' parameters and return type must be same as delegate `{2} {3}' parameters and return type",
                                TypeManager.CSharpName(((MethodInfo)method).ReturnType), member_name,
                                TypeManager.CSharpName(invoke_method.ReturnType), Delegate.FullDelegateDesc(invoke_method));
                return;
            }
            if (return_type == null)
            {
                ec.Report.Error(123, loc, "A method or delegate `{0}' parameters do not match delegate `{1}' parameters",
                                member_name, Delegate.FullDelegateDesc(invoke_method));
                return;
            }

            ec.Report.Error(407, loc, "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' return type",
                            return_type.GetSignatureForError(), member_name,
                            TypeManager.CSharpName(invoke_method.ReturnType), Delegate.FullDelegateDesc(invoke_method));
        }
Exemple #3
0
 static void Report419(MemberCore mc, string member_name, MemberSpec [] mis, Report Report)
 {
     Report.Warning(419, 3, mc.Location,
                    "Ambiguous reference in cref attribute `{0}'. Assuming `{1}' but other overloads including `{2}' have also matched",
                    member_name,
                    TypeManager.GetFullNameSignature(mis [0]),
                    TypeManager.GetFullNameSignature(mis [1]));
 }
Exemple #4
0
        public void CheckObsoleteness(Location loc)
        {
            ObsoleteAttribute oa = AttributeTester.GetMemberObsoleteAttribute(fi);

            if (oa == null)
            {
                return;
            }

            AttributeTester.Report_ObsoleteMessage(oa, TypeManager.GetFullNameSignature(fi), loc, RootContext.ToplevelTypes.Compiler.Report);
        }
Exemple #5
0
        public void SymbolRelatedToPreviousError(MemberInfo mi)
        {
            if (reporting_disabled > 0 || !printer.HasRelatedSymbolSupport)
            {
                return;
            }

            Type dt = TypeManager.DropGenericTypeArguments(mi.DeclaringType);

            if (TypeManager.IsDelegateType(dt))
            {
                SymbolRelatedToPreviousError(dt);
                return;
            }

            DeclSpace temp_ds = TypeManager.LookupDeclSpace(dt);

            if (temp_ds == null)
            {
                SymbolRelatedToPreviousError(dt.Assembly.Location, TypeManager.GetFullNameSignature(mi));
            }
            else
            {
                MethodBase mb = mi as MethodBase;
                if (mb != null)
                {
                    mb = TypeManager.DropGenericMethodArguments(mb);
                    IMethodData md = TypeManager.GetMethod(mb);
                    if (md != null)
                    {
                        SymbolRelatedToPreviousError(md.Location, md.GetSignatureForError());
                    }

                    return;
                }

                // FIXME: Completely wrong, it has to use FindMembers
                MemberCore mc = temp_ds.GetDefinition(mi.Name);
                if (mc != null)
                {
                    SymbolRelatedToPreviousError(mc);
                }
            }
        }
Exemple #6
0
 public static string FullDelegateDesc(MethodSpec invoke_method)
 {
     return(TypeManager.GetFullNameSignature(invoke_method).Replace(".Invoke", ""));
 }
Exemple #7
0
        public override Expression DoResolve(ResolveContext ec)
        {
            constructor_method = Delegate.GetConstructor(ec.Compiler, ec.CurrentType, type);

            MethodInfo invoke_method = Delegate.GetInvokeMethod(ec.Compiler, ec.CurrentType, type);

            method_group.DelegateType       = type;
            method_group.CustomErrorHandler = this;

            Arguments arguments = CreateDelegateMethodArguments(TypeManager.GetParameterData(invoke_method), loc);

            method_group = method_group.OverloadResolve(ec, ref arguments, false, loc);
            if (method_group == null)
            {
                return(null);
            }

            delegate_method = (MethodInfo)method_group;

            if (TypeManager.IsNullableType(delegate_method.DeclaringType))
            {
                ec.Report.Error(1728, loc, "Cannot create delegate from method `{0}' because it is a member of System.Nullable<T> type",
                                TypeManager.GetFullNameSignature(delegate_method));
                return(null);
            }

            Invocation.IsSpecialMethodInvocation(ec, delegate_method, loc);

            ExtensionMethodGroupExpr emg = method_group as ExtensionMethodGroupExpr;

            if (emg != null)
            {
                delegate_instance_expression = emg.ExtensionExpression;
                Type e_type = delegate_instance_expression.Type;
                if (TypeManager.IsValueType(e_type))
                {
                    ec.Report.Error(1113, loc, "Extension method `{0}' of value type `{1}' cannot be used to create delegates",
                                    TypeManager.CSharpSignature(delegate_method), TypeManager.CSharpName(e_type));
                }
            }

            Type       rt       = TypeManager.TypeToCoreType(delegate_method.ReturnType);
            Expression ret_expr = new TypeExpression(rt, loc);

            if (!Delegate.IsTypeCovariant(ret_expr, (TypeManager.TypeToCoreType(invoke_method.ReturnType))))
            {
                Error_ConversionFailed(ec, delegate_method, ret_expr);
            }

            if (Invocation.IsMethodExcluded(delegate_method, loc))
            {
                ec.Report.SymbolRelatedToPreviousError(delegate_method);
                MethodOrOperator m = TypeManager.GetMethod(delegate_method) as MethodOrOperator;
                if (m != null && m.IsPartialDefinition)
                {
                    ec.Report.Error(762, loc, "Cannot create delegate from partial method declaration `{0}'",
                                    TypeManager.CSharpSignature(delegate_method));
                }
                else
                {
                    ec.Report.Error(1618, loc, "Cannot create delegate with `{0}' because it has a Conditional attribute",
                                    TypeManager.CSharpSignature(delegate_method));
                }
            }

            DoResolveInstanceExpression(ec);
            eclass = ExprClass.Value;
            return(this);
        }