~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to contrib/ICSharpCode.NRefactory/TypeSystem/ITypeDefinition.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (c) 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
 
 
23
 
namespace ICSharpCode.NRefactory.TypeSystem
24
 
{
25
 
        /// <summary>
26
 
        /// Represents an unresolved class, enum, interface, struct, delegate or VB module.
27
 
        /// For partial classes, an unresolved type definition represents only a single part.
28
 
        /// </summary>
29
 
        public interface IUnresolvedTypeDefinition : ITypeReference, IUnresolvedEntity
30
 
        {
31
 
                TypeKind Kind { get; }
32
 
                
33
 
                IList<ITypeReference> BaseTypes { get; }
34
 
                IList<IUnresolvedTypeParameter> TypeParameters { get; }
35
 
                
36
 
                IList<IUnresolvedTypeDefinition> NestedTypes { get; }
37
 
                IList<IUnresolvedMember> Members { get; }
38
 
                
39
 
                IEnumerable<IUnresolvedMethod> Methods { get; }
40
 
                IEnumerable<IUnresolvedProperty> Properties { get; }
41
 
                IEnumerable<IUnresolvedField> Fields { get; }
42
 
                IEnumerable<IUnresolvedEvent> Events { get; }
43
 
                
44
 
                /// <summary>
45
 
                /// Gets whether the type definition contains extension methods.
46
 
                /// Returns null when the type definition needs to be resolved in order to determine whether
47
 
                /// methods are extension methods.
48
 
                /// </summary>
49
 
                bool? HasExtensionMethods { get; }
50
 
                
51
 
                /// <summary>
52
 
                /// Looks up the resolved type definition from the <paramref name="context"/> corresponding to this unresolved
53
 
                /// type definition.
54
 
                /// </summary>
55
 
                /// <param name="context">
56
 
                /// Context for looking up the type. The context must specify the current assembly.
57
 
                /// A <see cref="Implementation.SimpleTypeResolveContext"/> that specifies the current assembly is sufficient.
58
 
                /// </param>
59
 
                /// <returns>
60
 
                /// Returns the resolved type definition.
61
 
                /// In case of an error, returns an <see cref="Implementation.UnknownType"/> instance.
62
 
                /// Never returns null.
63
 
                /// </returns>
64
 
                new IType Resolve(ITypeResolveContext context);
65
 
                
66
 
                /// <summary>
67
 
                /// This method is used to add language-specific elements like the C# UsingScope
68
 
                /// to the type resolve context.
69
 
                /// </summary>
70
 
                /// <param name="parentContext">The parent context (e.g. the parent assembly),
71
 
                /// including the parent type definition for inner classes.</param>
72
 
                /// <returns>
73
 
                /// The parent context, modified to include language-specific elements (e.g. using scope)
74
 
                /// associated with this type definition.
75
 
                /// </returns>
76
 
                /// <remarks>
77
 
                /// Use <c>unresolvedTypeDef.CreateResolveContext(parentContext).WithTypeDefinition(typeDef)</c> to
78
 
                /// create the context for use within the type definition.
79
 
                /// </remarks>
80
 
                ITypeResolveContext CreateResolveContext(ITypeResolveContext parentContext);
81
 
        }
82
 
        
83
 
        /// <summary>
84
 
        /// Represents a class, enum, interface, struct, delegate or VB module.
85
 
        /// For partial classes, this represents the whole class.
86
 
        /// </summary>
87
 
        public interface ITypeDefinition : IType, IEntity
88
 
        {
89
 
                /// <summary>
90
 
                /// Returns all parts that contribute to this type definition.
91
 
                /// Non-partial classes have a single part that represents the whole class.
92
 
                /// </summary>
93
 
                IList<IUnresolvedTypeDefinition> Parts { get; }
94
 
                
95
 
                IList<ITypeParameter> TypeParameters { get; }
96
 
                
97
 
                IList<ITypeDefinition> NestedTypes { get; }
98
 
                IList<IMember> Members { get; }
99
 
                
100
 
                IEnumerable<IField> Fields { get; }
101
 
                IEnumerable<IMethod> Methods { get; }
102
 
                IEnumerable<IProperty> Properties { get; }
103
 
                IEnumerable<IEvent> Events { get; }
104
 
                
105
 
                /// <summary>
106
 
                /// Gets the known type code for this type definition.
107
 
                /// </summary>
108
 
                KnownTypeCode KnownTypeCode { get; }
109
 
                
110
 
                /// <summary>
111
 
                /// For enums: returns the underlying primitive type.
112
 
                /// For all other types: returns <see cref="SpecialType.UnknownType"/>.
113
 
                /// </summary>
114
 
                IType EnumUnderlyingType { get; }
115
 
                
116
 
                /// <summary>
117
 
                /// Gets/Sets the declaring type (incl. type arguments, if any).
118
 
                /// This property never returns null -- for top-level entities, it returns SharedTypes.UnknownType.
119
 
                /// </summary>
120
 
                new IType DeclaringType { get; } // solves ambiguity between IType.DeclaringType and IEntity.DeclaringType
121
 
                
122
 
                /// <summary>
123
 
                /// Gets whether this type contains extension methods.
124
 
                /// </summary>
125
 
                /// <remarks>This property is used to speed up the search for extension methods.</remarks>
126
 
                bool HasExtensionMethods { get; }
127
 
        }
128
 
}