C# Класс ICSharpCode.NRefactory.CSharp.Resolver.OverloadResolution

C# overload resolution (C# 4.0 spec: §7.5).
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddCandidate ( IParameterizedMember member ) : OverloadResolutionErrors

Adds a candidate to overload resolution.

AddCandidate ( IParameterizedMember member, OverloadResolutionErrors additionalErrors ) : OverloadResolutionErrors

Adds a candidate to overload resolution.

AddMethodLists ( IList methodLists ) : void

Adds all candidates from the method lists. This method implements the logic that causes applicable methods in derived types to hide all methods in base types.

CreateResolveResult ( ResolveResult targetResolveResult, IList initializerStatements = null, IType returnTypeOverride = null ) : ICSharpCode.NRefactory.CSharp.Resolver.CSharpInvocationResolveResult

Creates a ResolveResult representing the result of overload resolution.

GetArgumentToParameterMap ( ) : IList

Gets an array that maps argument indices to parameter indices. For arguments that could not be mapped to any parameter, the value will be -1. parameterIndex = GetArgumentToParameterMap()[argumentIndex]

GetArgumentsWithConversions ( ) : IList

Returns the arguments for the method call in the order they were provided (not in the order of the parameters). Arguments are wrapped in a ConversionResolveResult if an implicit conversion is being applied to them when calling the method.

GetArgumentsWithConversionsAndNames ( ) : IList

Returns the arguments for the method call in the order they were provided (not in the order of the parameters). Arguments are wrapped in a ConversionResolveResult if an implicit conversion is being applied to them when calling the method. For arguments where an explicit argument name was provided, the argument will be wrapped in a NamedArgumentResolveResult.

GetBestCandidateWithSubstitutedTypeArguments ( ) : IParameterizedMember
IsApplicable ( OverloadResolutionErrors errors ) : bool

Returns whether a candidate with the given errors is still considered to be applicable.

OverloadResolution ( ICompilation compilation, ResolveResult arguments, string argumentNames = null, IType typeArguments = null, CSharpConversions conversions = null ) : System
ValidateConstraints ( ITypeParameter typeParameter, IType typeArgument, ICSharpCode.NRefactory.TypeSystem.TypeVisitor substitution = null ) : bool

Validates whether the given type argument satisfies the constraints for the given type parameter.

Приватные методы

Метод Описание
BetterFunctionMember ( Candidate c1, Candidate c2 ) : int

Returns 1 if c1 is better than c2; 2 if c2 is better than c1; or 0 if neither is better.

CalculateCandidate ( Candidate candidate ) : bool

Calculates applicability etc. for the candidate.

CheckApplicability ( Candidate candidate ) : void
ConsiderIfNewCandidateIsBest ( Candidate candidate ) : void
GetArgumentsWithConversions ( ResolveResult targetResolveResult, IParameterizedMember bestCandidateForNamedArguments ) : IList
GetSubstitution ( Candidate candidate ) : TypeParameterSubstitution
LogCandidateAddingResult ( string text, IParameterizedMember method, OverloadResolutionErrors errors ) : void
MapCorrespondingParameters ( Candidate candidate ) : void
MoreSpecificFormalParameter ( IType t1, IType t2 ) : int
MoreSpecificFormalParameters ( Candidate c1, Candidate c2 ) : int
MoreSpecificFormalParameters ( IEnumerable t1, IEnumerable t2 ) : int
ResolveParameterTypes ( Candidate candidate, bool useSpecializedParameters ) : bool
RunTypeInference ( Candidate candidate ) : void
ValidateConstraints ( ITypeParameter typeParameter, IType typeArgument, ICSharpCode.NRefactory.TypeSystem.TypeVisitor substitution, CSharpConversions conversions ) : bool
ValidateMethodConstraints ( Candidate candidate ) : OverloadResolutionErrors

Описание методов

AddCandidate() публичный Метод

Adds a candidate to overload resolution.
public AddCandidate ( IParameterizedMember member ) : OverloadResolutionErrors
member IParameterizedMember The candidate member to add.
Результат OverloadResolutionErrors

AddCandidate() публичный Метод

Adds a candidate to overload resolution.
public AddCandidate ( IParameterizedMember member, OverloadResolutionErrors additionalErrors ) : OverloadResolutionErrors
member IParameterizedMember The candidate member to add.
additionalErrors OverloadResolutionErrors Additional errors that apply to the candidate. /// This is used to represent errors during member lookup (e.g. OverloadResolutionErrors.Inaccessible) /// in overload resolution.
Результат OverloadResolutionErrors

AddMethodLists() публичный Метод

Adds all candidates from the method lists. This method implements the logic that causes applicable methods in derived types to hide all methods in base types.
public AddMethodLists ( IList methodLists ) : void
methodLists IList The methods, grouped by declaring type. Base types must come first in the list.
Результат void

CreateResolveResult() публичный Метод

Creates a ResolveResult representing the result of overload resolution.
public CreateResolveResult ( ResolveResult targetResolveResult, IList initializerStatements = null, IType returnTypeOverride = null ) : ICSharpCode.NRefactory.CSharp.Resolver.CSharpInvocationResolveResult
targetResolveResult ResolveResult /// The target expression of the call. May be null for static methods/constructors. ///
initializerStatements IList /// Statements for Objects/Collections initializer. /// /// /// If not null, use this instead of the ReturnType of the member as the type of the created resolve result. ///
returnTypeOverride IType
Результат ICSharpCode.NRefactory.CSharp.Resolver.CSharpInvocationResolveResult

GetArgumentToParameterMap() публичный Метод

Gets an array that maps argument indices to parameter indices. For arguments that could not be mapped to any parameter, the value will be -1. parameterIndex = GetArgumentToParameterMap()[argumentIndex]
public GetArgumentToParameterMap ( ) : IList
Результат IList

GetArgumentsWithConversions() публичный Метод

Returns the arguments for the method call in the order they were provided (not in the order of the parameters). Arguments are wrapped in a ConversionResolveResult if an implicit conversion is being applied to them when calling the method.
public GetArgumentsWithConversions ( ) : IList
Результат IList

GetArgumentsWithConversionsAndNames() публичный Метод

Returns the arguments for the method call in the order they were provided (not in the order of the parameters). Arguments are wrapped in a ConversionResolveResult if an implicit conversion is being applied to them when calling the method. For arguments where an explicit argument name was provided, the argument will be wrapped in a NamedArgumentResolveResult.
public GetArgumentsWithConversionsAndNames ( ) : IList
Результат IList

GetBestCandidateWithSubstitutedTypeArguments() публичный Метод

public GetBestCandidateWithSubstitutedTypeArguments ( ) : IParameterizedMember
Результат IParameterizedMember

IsApplicable() публичный статический Метод

Returns whether a candidate with the given errors is still considered to be applicable.
public static IsApplicable ( OverloadResolutionErrors errors ) : bool
errors OverloadResolutionErrors
Результат bool

OverloadResolution() публичный Метод

public OverloadResolution ( ICompilation compilation, ResolveResult arguments, string argumentNames = null, IType typeArguments = null, CSharpConversions conversions = null ) : System
compilation ICompilation
arguments ResolveResult
argumentNames string
typeArguments IType
conversions CSharpConversions
Результат System

ValidateConstraints() публичный статический Метод

Validates whether the given type argument satisfies the constraints for the given type parameter.
public static ValidateConstraints ( ITypeParameter typeParameter, IType typeArgument, ICSharpCode.NRefactory.TypeSystem.TypeVisitor substitution = null ) : bool
typeParameter ITypeParameter The type parameter.
typeArgument IType The type argument.
substitution ICSharpCode.NRefactory.TypeSystem.TypeVisitor The substitution that defines how type parameters are replaced with type arguments. /// The substitution is used to check constraints that depend on other type parameters (or recursively on the same type parameter). /// May be null if no substitution should be used.
Результат bool