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 | |
---|
19 | using System; |
---|
20 | using System.Collections.Generic; |
---|
21 | using System.Diagnostics.Contracts; |
---|
22 | using ICSharpCode.NRefactory.Documentation; |
---|
23 | |
---|
24 | namespace ICSharpCode.NRefactory.TypeSystem |
---|
25 | { |
---|
26 | /// <summary> |
---|
27 | /// Represents an unresolved entity. |
---|
28 | /// </summary> |
---|
29 | public interface IUnresolvedEntity : INamedElement, IHasAccessibility |
---|
30 | { |
---|
31 | /// <summary> |
---|
32 | /// Gets the entity type. |
---|
33 | /// </summary> |
---|
34 | SymbolKind SymbolKind { get; } |
---|
35 | |
---|
36 | /// <summary> |
---|
37 | /// Gets the complete entity region (including header+body) |
---|
38 | /// </summary> |
---|
39 | DomRegion Region { get; } |
---|
40 | |
---|
41 | /// <summary> |
---|
42 | /// Gets the entity body region. |
---|
43 | /// </summary> |
---|
44 | DomRegion BodyRegion { get; } |
---|
45 | |
---|
46 | /// <summary> |
---|
47 | /// Gets the declaring class. |
---|
48 | /// For members, this is the class that contains the member. |
---|
49 | /// For nested classes, this is the outer class. For top-level entities, this property returns null. |
---|
50 | /// </summary> |
---|
51 | IUnresolvedTypeDefinition DeclaringTypeDefinition { get; } |
---|
52 | |
---|
53 | /// <summary> |
---|
54 | /// Gets the parsed file in which this entity is defined. |
---|
55 | /// Returns null if this entity wasn't parsed from source code (e.g. loaded from a .dll with CecilLoader). |
---|
56 | /// </summary> |
---|
57 | IUnresolvedFile UnresolvedFile { get; } |
---|
58 | |
---|
59 | /// <summary> |
---|
60 | /// Gets the attributes on this entity. |
---|
61 | /// </summary> |
---|
62 | IList<IUnresolvedAttribute> Attributes { get; } |
---|
63 | |
---|
64 | /// <summary> |
---|
65 | /// Gets whether this entity is static. |
---|
66 | /// Returns true if either the 'static' or the 'const' modifier is set. |
---|
67 | /// </summary> |
---|
68 | bool IsStatic { get; } |
---|
69 | |
---|
70 | /// <summary> |
---|
71 | /// Returns whether this entity is abstract. |
---|
72 | /// </summary> |
---|
73 | /// <remarks>Static classes also count as abstract classes.</remarks> |
---|
74 | bool IsAbstract { get; } |
---|
75 | |
---|
76 | /// <summary> |
---|
77 | /// Returns whether this entity is sealed. |
---|
78 | /// </summary> |
---|
79 | /// <remarks>Static classes also count as sealed classes.</remarks> |
---|
80 | bool IsSealed { get; } |
---|
81 | |
---|
82 | /// <summary> |
---|
83 | /// Gets whether this member is declared to be shadowing another member with the same name. |
---|
84 | /// </summary> |
---|
85 | bool IsShadowing { get; } |
---|
86 | |
---|
87 | /// <summary> |
---|
88 | /// Gets whether this member is generated by a macro/compiler feature. |
---|
89 | /// </summary> |
---|
90 | bool IsSynthetic { get; } |
---|
91 | } |
---|
92 | |
---|
93 | /// <summary> |
---|
94 | /// Represents a resolved entity. |
---|
95 | /// </summary> |
---|
96 | public interface IEntity : ISymbol, ICompilationProvider, INamedElement, IHasAccessibility |
---|
97 | { |
---|
98 | /// <summary> |
---|
99 | /// Gets the entity type. |
---|
100 | /// </summary> |
---|
101 | [Obsolete("Use the SymbolKind property instead.")] |
---|
102 | EntityType EntityType { get; } |
---|
103 | |
---|
104 | /// <summary> |
---|
105 | /// Gets the short name of the entity. |
---|
106 | /// </summary> |
---|
107 | new string Name { get; } |
---|
108 | |
---|
109 | /// <summary> |
---|
110 | /// Gets the complete entity region (including header+body) |
---|
111 | /// </summary> |
---|
112 | DomRegion Region { get; } |
---|
113 | |
---|
114 | /// <summary> |
---|
115 | /// Gets the entity body region. |
---|
116 | /// </summary> |
---|
117 | DomRegion BodyRegion { get; } |
---|
118 | |
---|
119 | /// <summary> |
---|
120 | /// Gets the declaring class. |
---|
121 | /// For members, this is the class that contains the member. |
---|
122 | /// For nested classes, this is the outer class. For top-level entities, this property returns null. |
---|
123 | /// </summary> |
---|
124 | ITypeDefinition DeclaringTypeDefinition { get; } |
---|
125 | |
---|
126 | /// <summary> |
---|
127 | /// Gets/Sets the declaring type (incl. type arguments, if any). |
---|
128 | /// This property never returns null -- for top-level entities, it returns SharedTypes.UnknownType. |
---|
129 | /// If this is not a specialized member, the value returned is equal to <see cref="DeclaringTypeDefinition"/>. |
---|
130 | /// </summary> |
---|
131 | IType DeclaringType { get; } |
---|
132 | |
---|
133 | /// <summary> |
---|
134 | /// The assembly in which this entity is defined. |
---|
135 | /// This property never returns null. |
---|
136 | /// </summary> |
---|
137 | IAssembly ParentAssembly { get; } |
---|
138 | |
---|
139 | /// <summary> |
---|
140 | /// Gets the attributes on this entity. |
---|
141 | /// </summary> |
---|
142 | IList<IAttribute> Attributes { get; } |
---|
143 | |
---|
144 | /// <summary> |
---|
145 | /// Gets the documentation for this entity. |
---|
146 | /// </summary> |
---|
147 | DocumentationComment Documentation { get; } |
---|
148 | |
---|
149 | /// <summary> |
---|
150 | /// Gets whether this entity is static. |
---|
151 | /// Returns true if either the 'static' or the 'const' modifier is set. |
---|
152 | /// </summary> |
---|
153 | bool IsStatic { get; } |
---|
154 | |
---|
155 | /// <summary> |
---|
156 | /// Returns whether this entity is abstract. |
---|
157 | /// </summary> |
---|
158 | /// <remarks>Static classes also count as abstract classes.</remarks> |
---|
159 | bool IsAbstract { get; } |
---|
160 | |
---|
161 | /// <summary> |
---|
162 | /// Returns whether this entity is sealed. |
---|
163 | /// </summary> |
---|
164 | /// <remarks>Static classes also count as sealed classes.</remarks> |
---|
165 | bool IsSealed { get; } |
---|
166 | |
---|
167 | /// <summary> |
---|
168 | /// Gets whether this member is declared to be shadowing another member with the same name. |
---|
169 | /// (C# 'new' keyword) |
---|
170 | /// </summary> |
---|
171 | bool IsShadowing { get; } |
---|
172 | |
---|
173 | /// <summary> |
---|
174 | /// Gets whether this member is generated by a macro/compiler feature. |
---|
175 | /// </summary> |
---|
176 | bool IsSynthetic { get; } |
---|
177 | } |
---|
178 | } |
---|