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

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory/TypeSystem/ITypeParameter.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) 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.TypeSystem;
 
23
 
 
24
namespace ICSharpCode.NRefactory.TypeSystem
 
25
{
 
26
        /// <summary>
 
27
        /// Type parameter of a generic class/method.
 
28
        /// </summary>
 
29
        public interface IUnresolvedTypeParameter : INamedElement
 
30
        {
 
31
                /// <summary>
 
32
                /// Get the type of this type parameter's owner.
 
33
                /// </summary>
 
34
                /// <returns>EntityType.TypeDefinition or EntityType.Method</returns>
 
35
                EntityType OwnerType { get; }
 
36
                
 
37
                /// <summary>
 
38
                /// Gets the index of the type parameter in the type parameter list of the owning method/class.
 
39
                /// </summary>
 
40
                int Index { get; }
 
41
                
 
42
                /// <summary>
 
43
                /// Gets the list of attributes declared on this type parameter.
 
44
                /// </summary>
 
45
                IList<IUnresolvedAttribute> Attributes { get; }
 
46
                
 
47
                /// <summary>
 
48
                /// Gets the variance of this type parameter.
 
49
                /// </summary>
 
50
                VarianceModifier Variance { get; }
 
51
                
 
52
                /// <summary>
 
53
                /// Gets the region where the type parameter is defined.
 
54
                /// </summary>
 
55
                DomRegion Region { get; }
 
56
                
 
57
                ITypeParameter CreateResolvedTypeParameter(ITypeResolveContext context);
 
58
        }
 
59
        
 
60
        /// <summary>
 
61
        /// Type parameter of a generic class/method.
 
62
        /// </summary>
 
63
        public interface ITypeParameter : IType
 
64
        {
 
65
                /// <summary>
 
66
                /// Get the type of this type parameter's owner.
 
67
                /// </summary>
 
68
                /// <returns>EntityType.TypeDefinition or EntityType.Method</returns>
 
69
                EntityType OwnerType { get; }
 
70
                
 
71
                /// <summary>
 
72
                /// Gets the owning method/class.
 
73
                /// This property may return null (for example for the dummy type parameters used by <see cref="ParameterListComparer.NormalizeMethodTypeParameters"/>).
 
74
                /// </summary>
 
75
                /// <remarks>
 
76
                /// For "class Outer&lt;T&gt; { class Inner {} }",
 
77
                /// inner.TypeParameters[0].Owner will be the outer class, because the same
 
78
                /// ITypeParameter instance is used both on Outer`1 and Outer`1+Inner.
 
79
                /// </remarks>
 
80
                IEntity Owner { get; }
 
81
                
 
82
                /// <summary>
 
83
                /// Gets the index of the type parameter in the type parameter list of the owning method/class.
 
84
                /// </summary>
 
85
                int Index { get; }
 
86
                
 
87
                /// <summary>
 
88
                /// Gets the list of attributes declared on this type parameter.
 
89
                /// </summary>
 
90
                IList<IAttribute> Attributes { get; }
 
91
                
 
92
                /// <summary>
 
93
                /// Gets the variance of this type parameter.
 
94
                /// </summary>
 
95
                VarianceModifier Variance { get; }
 
96
                
 
97
                /// <summary>
 
98
                /// Gets the region where the type parameter is defined.
 
99
                /// </summary>
 
100
                DomRegion Region { get; }
 
101
                
 
102
                /// <summary>
 
103
                /// Gets the effective base class of this type parameter.
 
104
                /// </summary>
 
105
                IType EffectiveBaseClass { get; }
 
106
                
 
107
                /// <summary>
 
108
                /// Gets the effective interface set of this type parameter.
 
109
                /// </summary>
 
110
                ICollection<IType> EffectiveInterfaceSet { get; }
 
111
                
 
112
                /// <summary>
 
113
                /// Gets if the type parameter has the 'new()' constraint.
 
114
                /// </summary>
 
115
                bool HasDefaultConstructorConstraint { get; }
 
116
                
 
117
                /// <summary>
 
118
                /// Gets if the type parameter has the 'class' constraint.
 
119
                /// </summary>
 
120
                bool HasReferenceTypeConstraint { get; }
 
121
                
 
122
                /// <summary>
 
123
                /// Gets if the type parameter has the 'struct' constraint.
 
124
                /// </summary>
 
125
                bool HasValueTypeConstraint { get; }
 
126
        }
 
127
        
 
128
        /// <summary>
 
129
        /// Represents the variance of a type parameter.
 
130
        /// </summary>
 
131
        public enum VarianceModifier : byte
 
132
        {
 
133
                /// <summary>
 
134
                /// The type parameter is not variant.
 
135
                /// </summary>
 
136
                Invariant,
 
137
                /// <summary>
 
138
                /// The type parameter is covariant (used in output position).
 
139
                /// </summary>
 
140
                Covariant,
 
141
                /// <summary>
 
142
                /// The type parameter is contravariant (used in input position).
 
143
                /// </summary>
 
144
                Contravariant
 
145
        };
 
146
}