Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ InternalGetConstructorToken()

int System.Reflection.Emit.ModuleBuilder.InternalGetConstructorToken ( ConstructorInfo con,
bool usingRef )
inlinepackage

Definition at line 196 of file ModuleBuilder.cs.

197 {
198 if (con == null)
199 {
200 throw new ArgumentNullException("con");
201 }
203 if (con is ConstructorBuilder constructorBuilder)
204 {
205 if (!usingRef && constructorBuilder.Module.Equals(this))
206 {
207 return constructorBuilder.MetadataToken;
208 }
210 return GetMemberRef(con.ReflectedType.Module, typeTokenInternal, constructorBuilder.MetadataToken);
211 }
212 if (con is ConstructorOnTypeBuilderInstantiation constructorOnTypeBuilderInstantiation)
213 {
214 if (usingRef)
215 {
216 throw new InvalidOperationException();
217 }
219 return GetMemberRef(con.DeclaringType.Module, typeTokenInternal, constructorOnTypeBuilderInstantiation.MetadataToken);
220 }
221 if (con is RuntimeConstructorInfo method && !con.ReflectedType.IsArray)
222 {
225 }
226 ParameterInfo[] parameters = con.GetParameters();
227 if (parameters == null)
228 {
229 throw new ArgumentException(SR.Argument_InvalidConstructorInfo);
230 }
231 Type[] array = new Type[parameters.Length];
232 Type[][] array2 = new Type[parameters.Length][];
233 Type[][] array3 = new Type[parameters.Length][];
234 for (int i = 0; i < parameters.Length; i++)
235 {
236 if (parameters[i] == null)
237 {
238 throw new ArgumentException(SR.Argument_InvalidConstructorInfo);
239 }
240 array[i] = parameters[i].ParameterType;
241 array2[i] = parameters[i].GetRequiredCustomModifiers();
242 array3[i] = parameters[i].GetOptionalCustomModifiers();
243 }
245 SignatureHelper methodSigHelper = SignatureHelper.GetMethodSigHelper(this, con.CallingConvention, null, null, null, array, array2, array3);
246 int length;
247 byte[] signature = methodSigHelper.InternalGetSignature(out length);
249 }
static int GetMemberRef(QCallModule module, QCallModule refedModule, int tr, int defToken)
static int GetMemberRefOfMethodInfo(QCallModule module, int tr, RuntimeMethodHandleInternal method)
static int GetMemberRefFromSignature(QCallModule module, int tr, string methodName, byte[] signature, int length)

References System.SR.Argument_InvalidConstructorInfo, System.array, System.Reflection.Emit.ModuleBuilder.GetMemberRef(), System.Reflection.Emit.ModuleBuilder.GetMemberRefFromSignature(), System.Reflection.Emit.ModuleBuilder.GetMemberRefOfMethodInfo(), System.Reflection.Emit.SignatureHelper.GetMethodSigHelper(), System.Reflection.ParameterInfo.GetOptionalCustomModifiers(), System.Reflection.ParameterInfo.GetRequiredCustomModifiers(), System.Reflection.Emit.ModuleBuilder.GetTypeTokenInternal(), System.length, and System.Reflection.ParameterInfo.ParameterType.

Referenced by System.Reflection.Emit.ModuleBuilder.GetConstructorToken().