IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
ConstructorBuilder.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2008-2011 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;
25using System.Collections.Generic;
26
28{
29
30 internal sealed class ConstructorBuilder : ConstructorInfo
31 {
32
33 readonly MethodBuilder methodBuilder;
34
39 internal ConstructorBuilder(MethodBuilder mb)
40 {
41 this.methodBuilder = mb;
42 }
43
44 public override bool Equals(object obj)
45 {
46 ConstructorBuilder other = obj as ConstructorBuilder;
47 return other != null && other.methodBuilder.Equals(methodBuilder);
48 }
49
50 public override int GetHashCode()
51 {
52 return methodBuilder.GetHashCode();
53 }
54
55 public void __SetSignature(Type returnType, CustomModifiers returnTypeCustomModifiers, Type[] parameterTypes, CustomModifiers[] parameterTypeCustomModifiers)
56 {
57 methodBuilder.__SetSignature(returnType, returnTypeCustomModifiers, parameterTypes, parameterTypeCustomModifiers);
58 }
59
60 [Obsolete("Please use __SetSignature(Type, CustomModifiers, Type[], CustomModifiers[]) instead.")]
61 public void __SetSignature(Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
62 {
63 methodBuilder.SetSignature(returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers);
64 }
65
66 public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string strParamName)
67 {
68 return methodBuilder.DefineParameter(position, attributes, strParamName);
69 }
70
71 public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
72 {
73 methodBuilder.SetCustomAttribute(customBuilder);
74 }
75
76 public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
77 {
78 methodBuilder.SetCustomAttribute(con, binaryAttribute);
79 }
80
81 public void __AddDeclarativeSecurity(CustomAttributeBuilder customBuilder)
82 {
83 methodBuilder.__AddDeclarativeSecurity(customBuilder);
84 }
85
86 public void AddDeclarativeSecurity(System.Security.Permissions.SecurityAction securityAction, System.Security.PermissionSet permissionSet)
87 {
88 methodBuilder.AddDeclarativeSecurity(securityAction, permissionSet);
89 }
90
91 public void SetImplementationFlags(MethodImplAttributes attributes)
92 {
93 methodBuilder.SetImplementationFlags(attributes);
94 }
95
96 public ILGenerator GetILGenerator()
97 {
98 return methodBuilder.GetILGenerator();
99 }
100
101 public ILGenerator GetILGenerator(int streamSize)
102 {
103 return methodBuilder.GetILGenerator(streamSize);
104 }
105
106 public Type ReturnType
107 {
108 get { return methodBuilder.ReturnType; }
109 }
110
111 public Module GetModule()
112 {
113 return methodBuilder.GetModule();
114 }
115
116 public MethodToken GetToken()
117 {
118 return methodBuilder.GetToken();
119 }
120
121 public bool InitLocals
122 {
123 get { return methodBuilder.InitLocals; }
124 set { methodBuilder.InitLocals = value; }
125 }
126
135 public void SetMethodBody(byte[] il, int maxStack, byte[] localSignature, IEnumerable<ExceptionHandler> exceptionHandlers, IEnumerable<int> tokenFixups)
136 {
137 methodBuilder.SetMethodBody(il, maxStack, localSignature, exceptionHandlers, tokenFixups);
138 }
139
140 internal override MethodInfo GetMethodInfo()
141 {
142 return methodBuilder;
143 }
144
145 internal override MethodInfo GetMethodOnTypeDefinition()
146 {
147 return methodBuilder;
148 }
149
150 }
151
152}
IKVM.Reflection.Module Module
IKVM.Reflection.Type Type
IKVM.Reflection.ConstructorInfo ConstructorInfo
IKVM.Reflection.MethodInfo MethodInfo