IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
__StandAloneMethodSig.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2010 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*/
24using System.Runtime.InteropServices;
25
26namespace IKVM.Reflection
27{
28
29 internal sealed class __StandAloneMethodSig
30 {
31
32 readonly bool unmanaged;
33 readonly CallingConvention unmanagedCallingConvention;
34 readonly CallingConventions callingConvention;
35 readonly Type returnType;
36 readonly Type[] parameterTypes;
37 readonly Type[] optionalParameterTypes;
38 readonly PackedCustomModifiers customModifiers;
39
50 internal __StandAloneMethodSig(bool unmanaged, CallingConvention unmanagedCallingConvention, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type[] optionalParameterTypes, PackedCustomModifiers customModifiers)
51 {
52 this.unmanaged = unmanaged;
53 this.unmanagedCallingConvention = unmanagedCallingConvention;
54 this.callingConvention = callingConvention;
55 this.returnType = returnType;
56 this.parameterTypes = parameterTypes;
57 this.optionalParameterTypes = optionalParameterTypes;
58 this.customModifiers = customModifiers;
59 }
60
61 public bool Equals(__StandAloneMethodSig other)
62 {
63 return other != null
64 && other.unmanaged == unmanaged
65 && other.unmanagedCallingConvention == unmanagedCallingConvention
66 && other.callingConvention == callingConvention
67 && other.returnType == returnType
68 && Util.ArrayEquals(other.parameterTypes, parameterTypes)
69 && Util.ArrayEquals(other.optionalParameterTypes, optionalParameterTypes)
70 && other.customModifiers.Equals(customModifiers);
71 }
72
73 public override bool Equals(object obj)
74 {
75 return Equals(obj as __StandAloneMethodSig);
76 }
77
78 public override int GetHashCode()
79 {
80 return returnType.GetHashCode()
81 ^ Util.GetHashCode(parameterTypes);
82 }
83
84 public bool IsUnmanaged
85 {
86 get { return unmanaged; }
87 }
88
89 public CallingConventions CallingConvention
90 {
91 get { return callingConvention; }
92 }
93
94 public CallingConvention UnmanagedCallingConvention
95 {
96 get { return unmanagedCallingConvention; }
97 }
98
99 public Type ReturnType
100 {
101 get { return returnType; }
102 }
103
104 public CustomModifiers GetReturnTypeCustomModifiers()
105 {
106 return customModifiers.GetReturnTypeCustomModifiers();
107 }
108
109 public Type[] ParameterTypes
110 {
111 get { return Util.Copy(parameterTypes); }
112 }
113
114 public Type[] OptionalParameterTypes
115 {
116 get { return Util.Copy(optionalParameterTypes); }
117 }
118
119 public CustomModifiers GetParameterCustomModifiers(int index)
120 {
121 return customModifiers.GetParameterCustomModifiers(index);
122 }
123
124 public bool ContainsMissingType
125 {
126 get
127 {
128 return returnType.__ContainsMissingType
129 || Type.ContainsMissingType(parameterTypes)
130 || Type.ContainsMissingType(optionalParameterTypes)
131 || customModifiers.ContainsMissingType;
132 }
133 }
134
135 internal int ParameterCount
136 {
137 get { return parameterTypes.Length + optionalParameterTypes.Length; }
138 }
139
140 }
141
142}
IKVM.Reflection.Type Type
System.Runtime.InteropServices.CallingConvention CallingConvention
Definition Signature.cs:35