IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
ElementHolderType.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2009-2015 Jeroen Frijters
3
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
7
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
11
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
19
20 Jeroen Frijters
21 jeroen@frijters.net
22
23*/
25
26namespace IKVM.Reflection
27{
28
29 abstract class ElementHolderType : TypeInfo
30 {
31
32 protected readonly Type elementType;
33 int token;
34 readonly CustomModifiers mods;
35
42 protected ElementHolderType(Type elementType, CustomModifiers mods, byte sigElementType) :
43 base(sigElementType)
44 {
45 this.elementType = elementType;
46 this.mods = mods;
47 }
48
49 protected bool EqualsHelper(ElementHolderType other)
50 {
51 return other != null
52 && other.elementType.Equals(elementType)
53 && other.mods.Equals(mods);
54 }
55
56 public override CustomModifiers __GetCustomModifiers()
57 {
58 return mods;
59 }
60
61 public sealed override string Name
62 {
63 get { return elementType.Name + GetSuffix(); }
64 }
65
66 public sealed override string Namespace
67 {
68 get { return elementType.Namespace; }
69 }
70
71 public sealed override string FullName
72 {
73 get { return elementType.FullName + GetSuffix(); }
74 }
75
76 public sealed override string ToString()
77 {
78 return elementType.ToString() + GetSuffix();
79 }
80
81 public sealed override Type GetElementType()
82 {
83 return elementType;
84 }
85
86 public sealed override Module Module
87 {
88 get { return elementType.Module; }
89 }
90
91 internal sealed override int GetModuleBuilderToken()
92 {
93 if (token == 0)
94 token = ((ModuleBuilder)elementType.Module).ImportType(this);
95
96 return token;
97 }
98
99 public sealed override bool ContainsGenericParameters
100 {
101 get
102 {
103 var type = elementType;
104 while (type.HasElementType)
105 type = type.GetElementType();
106
107 return type.ContainsGenericParameters;
108 }
109 }
110
111 protected sealed override bool ContainsMissingTypeImpl
112 {
113 get
114 {
115 var type = elementType;
116 while (type.HasElementType)
117 type = type.GetElementType();
118
119 return type.__ContainsMissingType || mods.ContainsMissingType;
120 }
121 }
122
123 protected sealed override bool IsValueTypeImpl
124 {
125 get { return false; }
126 }
127
128 internal sealed override Type BindTypeParameters(IGenericBinder binder)
129 {
130 var type = elementType.BindTypeParameters(binder);
131 var mods = this.mods.Bind(binder);
132 if (ReferenceEquals(type, elementType) && mods.Equals(this.mods))
133 return this;
134
135 return Wrap(type, mods);
136 }
137
138 internal override void CheckBaked()
139 {
140 elementType.CheckBaked();
141 }
142
143 internal sealed override Universe Universe
144 {
145 get { return elementType.Universe; }
146 }
147
148 internal sealed override bool IsBaked
149 {
150 get { return elementType.IsBaked; }
151 }
152
153 internal sealed override int GetCurrentToken()
154 {
155 // we don't have a token, so we return 0 (which is never a valid token)
156 return 0;
157 }
158
159 internal abstract string GetSuffix();
160
161 protected abstract Type Wrap(Type type, CustomModifiers mods);
162
163 }
164
165}
global::java.lang.invoke.LambdaForm.Name Name
bool EqualsHelper(ElementHolderType other)
ElementHolderType(Type elementType, CustomModifiers mods, byte sigElementType)
Initializes a new instance.
Type Wrap(Type type, CustomModifiers mods)
override CustomModifiers __GetCustomModifiers()