Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2839_HiveProjectManagement/HeuristicLab.ExtLibs/HeuristicLab.NRefactory/5.5.0/NRefactory-5.5.0/TypeSystem/IMethod.cs @ 15761

Last change on this file since 15761 was 11700, checked in by jkarder, 10 years ago

#2077: created branch and added first version

File size: 6.2 KB
Line 
1// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team
2//
3// Permission is hereby granted, free of charge, to any person obtaining a copy of this
4// software and associated documentation files (the "Software"), to deal in the Software
5// without restriction, including without limitation the rights to use, copy, modify, merge,
6// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
7// to whom the Software is furnished to do so, subject to the following conditions:
8//
9// The above copyright notice and this permission notice shall be included in all copies or
10// substantial portions of the Software.
11//
12// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
15// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
17// DEALINGS IN THE SOFTWARE.
18
19using System;
20using System.Collections.Generic;
21using System.Diagnostics.Contracts;
22using ICSharpCode.NRefactory.TypeSystem;
23
24namespace ICSharpCode.NRefactory.TypeSystem
25{
26  public interface IUnresolvedMethod : IUnresolvedParameterizedMember
27  {
28    /// <summary>
29    /// Gets the attributes associated with the return type. (e.g. [return: MarshalAs(...)])
30    /// </summary>
31    IList<IUnresolvedAttribute> ReturnTypeAttributes { get; }
32   
33    IList<IUnresolvedTypeParameter> TypeParameters { get; }
34   
35    bool IsConstructor { get; }
36    bool IsDestructor { get; }
37    bool IsOperator { get; }
38   
39    /// <summary>
40    /// Gets whether the method is a C#-style partial method.
41    /// Check <see cref="HasBody"/> to test if it is a partial method declaration or implementation.
42    /// </summary>
43    bool IsPartial { get; }
44
45    /// <summary>
46    /// Gets whether the method is a C#-style async method.
47    /// </summary>
48    bool IsAsync { get; }
49
50    [Obsolete("Use IsPartial && !HasBody instead")]
51    bool IsPartialMethodDeclaration { get; }
52   
53    [Obsolete("Use IsPartial && HasBody instead")]
54    bool IsPartialMethodImplementation { get; }
55   
56    /// <summary>
57    /// Gets whether the method has a body.
58    /// This property returns <c>false</c> for <c>abstract</c> or <c>extern</c> methods,
59    /// or for <c>partial</c> methods without implementation.
60    /// </summary>
61    bool HasBody { get; }
62   
63    /// <summary>
64    /// If this method is an accessor, returns a reference to the corresponding property/event.
65    /// Otherwise, returns null.
66    /// </summary>
67    IUnresolvedMember AccessorOwner { get; }
68   
69    /// <summary>
70    /// Resolves the member.
71    /// </summary>
72    /// <param name="context">
73    /// Context for looking up the member. The context must specify the current assembly.
74    /// A <see cref="SimpleTypeResolveContext"/> that specifies the current assembly is sufficient.
75    /// </param>
76    /// <returns>
77    /// Returns the resolved member, or <c>null</c> if the member could not be found.
78    /// </returns>
79    new IMethod Resolve(ITypeResolveContext context);
80  }
81 
82  /// <summary>
83  /// Represents a method, constructor, destructor or operator.
84  /// </summary>
85  public interface IMethod : IParameterizedMember
86  {
87    /// <summary>
88    /// Gets the unresolved method parts.
89    /// For partial methods, this returns all parts.
90    /// Otherwise, this returns an array with a single element (new[] { UnresolvedMember }).
91    /// NOTE: The type will change to IReadOnlyList&lt;IUnresolvedMethod&gt; in future versions.
92    /// </summary>
93    IList<IUnresolvedMethod> Parts { get; }
94   
95    /// <summary>
96    /// Gets the attributes associated with the return type. (e.g. [return: MarshalAs(...)])
97    /// NOTE: The type will change to IReadOnlyList&lt;IAttribute&gt; in future versions.
98    /// </summary>
99    IList<IAttribute> ReturnTypeAttributes { get; }
100
101    /// <summary>
102    /// Gets the type parameters of this method; or an empty list if the method is not generic.
103    /// NOTE: The type will change to IReadOnlyList&lt;ITypeParameter&gt; in future versions.
104    /// </summary>
105    IList<ITypeParameter> TypeParameters { get; }
106
107    /// <summary>
108    /// Gets whether this is a generic method that has been parameterized.
109    /// </summary>
110    bool IsParameterized { get; }
111   
112    /// <summary>
113    /// Gets the type arguments passed to this method.
114    /// If the method is generic but not parameterized yet, this property returns the type parameters,
115    /// as if the method was parameterized with its own type arguments (<c>void M&lt;T&gt;() { M&lt;T&gt;(); }</c>).
116    ///
117    /// NOTE: The type will change to IReadOnlyList&lt;IType&gt; in future versions.
118    /// </summary>
119    IList<IType> TypeArguments { get; }
120
121    bool IsExtensionMethod { get; }
122    bool IsConstructor { get; }
123    bool IsDestructor { get; }
124    bool IsOperator { get; }
125   
126    /// <summary>
127    /// Gets whether the method is a C#-style partial method.
128    /// A call to such a method is ignored by the compiler if the partial method has no body.
129    /// </summary>
130    /// <seealso cref="HasBody"/>
131    bool IsPartial { get; }
132
133    /// <summary>
134    /// Gets whether the method is a C#-style async method.
135    /// </summary>
136    bool IsAsync { get; }
137
138    /// <summary>
139    /// Gets whether the method has a body.
140    /// This property returns <c>false</c> for <c>abstract</c> or <c>extern</c> methods,
141    /// or for <c>partial</c> methods without implementation.
142    /// </summary>
143    bool HasBody { get; }
144   
145    /// <summary>
146    /// Gets whether the method is a property/event accessor.
147    /// </summary>
148    bool IsAccessor { get; }
149   
150    /// <summary>
151    /// If this method is an accessor, returns the corresponding property/event.
152    /// Otherwise, returns null.
153    /// </summary>
154    IMember AccessorOwner { get; }
155
156    /// <summary>
157    /// If this method is reduced from an extension method return the original method, <c>null</c> otherwise.
158    /// A reduced method doesn't contain the extension method parameter. That means that has one parameter less than it's definition.
159    /// </summary>
160    IMethod ReducedFrom { get; }
161   
162    /// <summary>
163    /// Specializes this method with the given substitution.
164    /// If this method is already specialized, the new substitution is composed with the existing substition.
165    /// </summary>
166    new IMethod Specialize(TypeParameterSubstitution substitution);
167  }
168}
Note: See TracBrowser for help on using the repository browser.