diff --git a/ICSharpCode.NRefactory.CSharp/Resolver/CSharpOperators.cs b/ICSharpCode.NRefactory.CSharp/Resolver/CSharpOperators.cs index 238c04c58c..c9bc5b9c30 100644 --- a/ICSharpCode.NRefactory.CSharp/Resolver/CSharpOperators.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/CSharpOperators.cs @@ -227,7 +227,13 @@ namespace ICSharpCode.NRefactory.CSharp.Resolver { throw new NotSupportedException(); } - + + TypeParameterSubstitution IMember.Substitution { + get { + return TypeParameterSubstitution.Identity; + } + } + string INamedElement.FullName { get { return "operator"; } } diff --git a/ICSharpCode.NRefactory.CSharp/Resolver/ReducedExtensionMethod.cs b/ICSharpCode.NRefactory.CSharp/Resolver/ReducedExtensionMethod.cs index 3d28dad2b1..039a032ff6 100644 --- a/ICSharpCode.NRefactory.CSharp/Resolver/ReducedExtensionMethod.cs +++ b/ICSharpCode.NRefactory.CSharp/Resolver/ReducedExtensionMethod.cs @@ -27,6 +27,7 @@ using System; using ICSharpCode.NRefactory.TypeSystem; using System.Collections.Generic; using System.Linq; +using ICSharpCode.NRefactory.TypeSystem.Implementation; namespace ICSharpCode.NRefactory.CSharp { @@ -143,6 +144,13 @@ namespace ICSharpCode.NRefactory.CSharp } } + public TypeParameterSubstitution Substitution { + get { + return baseMethod.Substitution; + } + } + + #endregion #region IMethod implementation @@ -220,9 +228,16 @@ namespace ICSharpCode.NRefactory.CSharp } public IMethod ReducedFrom { - get { return baseMethod; } + get { + return baseMethod; + } } + public IList TypeArguments { + get { + return baseMethod.TypeArguments; + } + } #endregion #region IParameterizedMember implementation diff --git a/ICSharpCode.NRefactory/TypeSystem/IMember.cs b/ICSharpCode.NRefactory/TypeSystem/IMember.cs index f021f37e7d..d6225d6194 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IMember.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IMember.cs @@ -170,5 +170,14 @@ namespace ICSharpCode.NRefactory.TypeSystem /// Otherwise, the main resolve context of a compilation is sufficient. /// IMemberReference ToMemberReference(); + + /// + /// Gets the substitution belonging to this specialized member. + /// Returns TypeParameterSubstitution.Identity for not specialized members. + /// + TypeParameterSubstitution Substitution { + get; + } + } } diff --git a/ICSharpCode.NRefactory/TypeSystem/IMethod.cs b/ICSharpCode.NRefactory/TypeSystem/IMethod.cs index 3faeb0b8aa..c534c0d815 100644 --- a/ICSharpCode.NRefactory/TypeSystem/IMethod.cs +++ b/ICSharpCode.NRefactory/TypeSystem/IMethod.cs @@ -97,7 +97,16 @@ namespace ICSharpCode.NRefactory.TypeSystem IList ReturnTypeAttributes { get; } IList TypeParameters { get; } - + + /// + /// Gets the type arguments passed to this method. + /// If only the type parameters for the class were specified and the generic method + /// itself is not specialized yet, this property will return an empty list. + /// + IList TypeArguments { + get; + } + bool IsExtensionMethod { get; } bool IsConstructor { get; } bool IsDestructor { get; } diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedMember.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedMember.cs index c7ee856955..12b39df4ae 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedMember.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractResolvedMember.cs @@ -117,7 +117,11 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation public bool IsOverridable { get { return unresolved.IsOverridable; } } - + + public TypeParameterSubstitution Substitution { + get { return TypeParameterSubstitution.Identity; } + } + public virtual IMemberReference ToMemberReference() { var declTypeRef = this.DeclaringType.ToTypeReference(); diff --git a/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedMethod.cs b/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedMethod.cs index 30493ed15a..c86033c0b3 100644 --- a/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedMethod.cs +++ b/ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultResolvedMethod.cs @@ -172,7 +172,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation public IList Parameters { get; private set; } public IList ReturnTypeAttributes { get; private set; } public IList TypeParameters { get; private set; } - + + static readonly IList emptyArguments = new IType[0]; + public IList TypeArguments { get { return emptyArguments; } } + public bool IsExtensionMethod { get; private set; } public IList Parts {