IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
ArrayMethod.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2008-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*/
24using System;
25
27{
28
29 class ArrayMethod : MethodInfo
30 {
31
32 readonly Module module;
33 readonly Type arrayClass;
34 readonly string methodName;
35 readonly CallingConventions callingConvention;
36 readonly Type returnType;
37 protected readonly Type[] parameterTypes;
38 MethodSignature methodSignature;
39
49 internal ArrayMethod(Module module, Type arrayClass, string methodName, CallingConventions callingConvention, Type returnType, Type[] parameterTypes)
50 {
51 this.module = module;
52 this.arrayClass = arrayClass;
53 this.methodName = methodName;
54 this.callingConvention = callingConvention;
55 this.returnType = returnType ?? module.Universe.System_Void;
56 this.parameterTypes = Util.Copy(parameterTypes);
57 }
58
59 public override MethodBody GetMethodBody()
60 {
61 throw new InvalidOperationException();
62 }
63
64 public override int __MethodRVA
65 {
66 get { throw new InvalidOperationException(); }
67 }
68
69 public override MethodImplAttributes GetMethodImplementationFlags()
70 {
71 throw new NotSupportedException();
72 }
73
74 public override ParameterInfo[] GetParameters()
75 {
76 throw new NotSupportedException();
77 }
78
79 internal override Type[] GetParameterTypes()
80 {
81 return parameterTypes;
82 }
83
84 internal override int ImportTo(ModuleBuilder module)
85 {
86 return module.ImportMethodOrField(arrayClass, methodName, MethodSignature);
87 }
88
89 public override MethodAttributes Attributes
90 {
91 get { throw new NotSupportedException(); }
92 }
93
94 public override CallingConventions CallingConvention
95 {
96 get { return callingConvention; }
97 }
98
99 public override Type DeclaringType
100 {
101 get { return arrayClass; }
102 }
103
104 internal override MethodSignature MethodSignature
105 {
106 get
107 {
108 if (methodSignature == null)
109 {
110 methodSignature = MethodSignature.MakeFromBuilder(returnType, parameterTypes, new PackedCustomModifiers(), callingConvention, 0);
111 }
112 return methodSignature;
113 }
114 }
115
116 public override Module Module
117 {
118 // FXBUG like .NET, we return the module that GetArrayMethod was called on, not the module associated with the array type
119 get { return module; }
120 }
121
122 public override string Name
123 {
124 get { return methodName; }
125 }
126
127 internal override int ParameterCount
128 {
129 get { return parameterTypes.Length; }
130 }
131
132 public override ParameterInfo ReturnParameter
133 {
134 // FXBUG like .NET, we throw NotImplementedException
135 get { throw new NotImplementedException(); }
136 }
137
138 public override Type ReturnType
139 {
140 get { return returnType; }
141 }
142
143 internal override bool HasThis
144 {
145 get { return (callingConvention & (CallingConventions.HasThis | CallingConventions.ExplicitThis)) == CallingConventions.HasThis; }
146 }
147
148 internal override int GetCurrentToken()
149 {
150 return this.MetadataToken;
151 }
152
153 internal override bool IsBaked
154 {
155 get { return arrayClass.IsBaked; }
156 }
157
158 }
159
160}
global::java.lang.invoke.LambdaForm.Name Name
System.Runtime.InteropServices.CallingConvention CallingConvention
Definition Signature.cs:35
override MethodAttributes Attributes
override MethodImplAttributes GetMethodImplementationFlags()
override ParameterInfo[] GetParameters()
override ParameterInfo ReturnParameter
override MethodBody GetMethodBody()
Represents a method signature from IL metadadata.