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


C# OverloadResolution.GetArgumentsWithConversions方法代码示例

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


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

示例1: InvocationResolveResult

		public InvocationResolveResult(ResolveResult targetResult, OverloadResolution or, ITypeResolveContext context)
			: base(
				or.IsExtensionMethodInvocation ? null : targetResult,
				or.GetBestCandidateWithSubstitutedTypeArguments(),
				context)
		{
			this.OverloadResolutionErrors = or.BestCandidateErrors;
			this.argumentToParameterMap = or.GetArgumentToParameterMap();
			this.Arguments = or.GetArgumentsWithConversions();
			
			this.IsExtensionMethodInvocation = or.IsExtensionMethodInvocation;
			this.IsExpandedForm = or.BestCandidateIsExpandedForm;
			this.IsLiftedOperatorInvocation = or.BestCandidate is OverloadResolution.ILiftedOperator;
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:14,代码来源:InvocationResolveResult.cs

示例2: ResolveInvocation

        /// <summary>
        /// Resolves an invocation.
        /// </summary>
        /// <param name="target">The target of the invocation. Usually a MethodGroupResolveResult.</param>
        /// <param name="arguments">
        /// Arguments passed to the method.
        /// The resolver may mutate this array to wrap elements in <see cref="ConversionResolveResult"/>s!
        /// </param>
        /// <param name="argumentNames">
        /// The argument names. Pass the null string for positional arguments.
        /// </param>
        /// <returns>InvocationResolveResult or UnknownMethodResolveResult</returns>
        public ResolveResult ResolveInvocation(ResolveResult target, ResolveResult[] arguments, string[] argumentNames = null)
        {
            // C# 4.0 spec: §7.6.5

            if (SpecialType.Dynamic.Equals(target.Type))
                return DynamicResult;

            MethodGroupResolveResult mgrr = target as MethodGroupResolveResult;
            if (mgrr != null) {
                OverloadResolution or = mgrr.PerformOverloadResolution(compilation, arguments, argumentNames, conversions: conversions);
                if (or.BestCandidate != null) {
                    return or.CreateResolveResult(mgrr.TargetResult);
                } else {
                    // No candidate found at all (not even an inapplicable one).
                    // This can happen with empty method groups (as sometimes used with extension methods)
                    return new UnknownMethodResolveResult(
                        mgrr.TargetType, mgrr.MethodName, mgrr.TypeArguments, CreateParameters(arguments, argumentNames));
                }
            }
            UnknownMemberResolveResult umrr = target as UnknownMemberResolveResult;
            if (umrr != null) {
                return new UnknownMethodResolveResult(umrr.TargetType, umrr.MemberName, umrr.TypeArguments, CreateParameters(arguments, argumentNames));
            }
            UnknownIdentifierResolveResult uirr = target as UnknownIdentifierResolveResult;
            if (uirr != null && CurrentTypeDefinition != null) {
                return new UnknownMethodResolveResult(CurrentTypeDefinition, uirr.Identifier, EmptyList<IType>.Instance, CreateParameters(arguments, argumentNames));
            }
            IMethod invokeMethod = target.Type.GetDelegateInvokeMethod();
            if (invokeMethod != null) {
                OverloadResolution or = new OverloadResolution(compilation, arguments, argumentNames, conversions: conversions);
                or.AddCandidate(invokeMethod);
                return new CSharpInvocationResolveResult(
                    target, invokeMethod, //invokeMethod.ReturnType.Resolve(context),
                    or.GetArgumentsWithConversions(), or.BestCandidateErrors,
                    isExpandedForm: or.BestCandidateIsExpandedForm,
                    isDelegateInvocation: true,
                    argumentToParameterMap: or.GetArgumentToParameterMap());
            }
            return ErrorResult;
        }
开发者ID:holmak,项目名称:NRefactory,代码行数:52,代码来源:CSharpResolver.cs

示例3: CreateResolveResultForUserDefinedOperator

		ResolveResult CreateResolveResultForUserDefinedOperator(OverloadResolution r, System.Linq.Expressions.ExpressionType operatorType)
		{
			if (r.BestCandidateErrors != OverloadResolutionErrors.None)
				return r.CreateResolveResult(null);
			IMethod method = (IMethod)r.BestCandidate;
			return new OperatorResolveResult(method.ReturnType, operatorType, method,
			                                 isLiftedOperator: method is OverloadResolution.ILiftedOperator,
			                                 operands: r.GetArgumentsWithConversions());
		}
开发者ID:nieve,项目名称:NRefactory,代码行数:9,代码来源:CSharpResolver.cs


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