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

◆ Init()

void System.Reflection.Emit.DynamicMethod.Init ( string name,
MethodAttributes attributes,
CallingConventions callingConvention,
Type returnType,
Type[] signature,
Type owner,
Module m,
bool skipVisibility,
bool transparentMethod )
inlineprivate

Definition at line 335 of file DynamicMethod.cs.

336 {
337 CheckConsistency(attributes, callingConvention);
338 if (signature != null)
339 {
340 m_parameterTypes = new RuntimeType[signature.Length];
341 for (int i = 0; i < signature.Length; i++)
342 {
343 if (signature[i] == null)
344 {
345 throw new ArgumentException(SR.Arg_InvalidTypeInSignature);
346 }
347 m_parameterTypes[i] = signature[i].UnderlyingSystemType as RuntimeType;
348 if (m_parameterTypes[i] == null || m_parameterTypes[i] == typeof(void))
349 {
350 throw new ArgumentException(SR.Arg_InvalidTypeInSignature);
351 }
352 }
353 }
354 else
355 {
356 m_parameterTypes = Array.Empty<RuntimeType>();
357 }
358 m_returnType = ((returnType == null) ? ((RuntimeType)typeof(void)) : (returnType.UnderlyingSystemType as RuntimeType));
359 if (m_returnType == null)
360 {
361 throw new NotSupportedException(SR.Arg_InvalidTypeInRetType);
362 }
363 if (transparentMethod)
364 {
366 if (skipVisibility)
367 {
369 }
370 }
371 else
372 {
373 if (m != null)
374 {
376 }
377 else
378 {
379 RuntimeType runtimeType = null;
380 if (owner != null)
381 {
382 runtimeType = owner.UnderlyingSystemType as RuntimeType;
383 }
384 if (runtimeType != null)
385 {
386 if (runtimeType.HasElementType || runtimeType.ContainsGenericParameters || runtimeType.IsGenericParameter || runtimeType.IsInterface)
387 {
388 throw new ArgumentException(SR.Argument_InvalidTypeForDynamicMethod);
389 }
390 m_typeOwner = runtimeType;
391 m_module = runtimeType.GetRuntimeModule();
392 }
393 }
394 m_skipVisibility = skipVisibility;
395 }
396 m_ilGenerator = null;
397 m_fInitLocals = true;
398 m_methodHandle = null;
399 if (name == null)
400 {
401 throw new ArgumentNullException("name");
402 }
403 m_dynMethod = new RTDynamicMethod(this, name, attributes, callingConvention);
404 }
static RuntimeModule GetDynamicMethodsModule()
static void CheckConsistency(MethodAttributes attributes, CallingConventions callingConvention)
ModuleHandle ModuleHandle
Definition Module.cs:64
override Type UnderlyingSystemType
RuntimeModule GetRuntimeModule()

References System.SR.Arg_InvalidTypeInRetType, System.SR.Arg_InvalidTypeInSignature, System.SR.Argument_InvalidTypeForDynamicMethod, System.Reflection.Emit.DynamicMethod.CheckConsistency(), System.RuntimeType.ContainsGenericParameters, System.Reflection.Emit.DynamicMethod.GetDynamicMethodsModule(), System.ModuleHandle.GetRuntimeModule(), System.RuntimeType.GetRuntimeModule(), System.Type.HasElementType, System.RuntimeType.IsGenericParameter, System.Type.IsInterface, System.Reflection.Emit.DynamicMethod.m_dynMethod, System.Reflection.Emit.DynamicMethod.m_fInitLocals, System.Reflection.Emit.DynamicMethod.m_ilGenerator, System.Reflection.Emit.DynamicMethod.m_methodHandle, System.Reflection.Emit.DynamicMethod.m_module, System.Reflection.Emit.DynamicMethod.m_parameterTypes, System.Reflection.Emit.DynamicMethod.m_restrictedSkipVisibility, System.Reflection.Emit.DynamicMethod.m_returnType, System.Reflection.Emit.DynamicMethod.m_skipVisibility, System.Reflection.Emit.DynamicMethod.m_typeOwner, System.Reflection.Module.ModuleHandle, and System.Type.UnderlyingSystemType.

Referenced by System.Reflection.Emit.DynamicMethod.DynamicMethod(), System.Reflection.Emit.DynamicMethod.DynamicMethod(), System.Reflection.Emit.DynamicMethod.DynamicMethod(), System.Reflection.Emit.DynamicMethod.DynamicMethod(), System.Reflection.Emit.DynamicMethod.DynamicMethod(), System.Reflection.Emit.DynamicMethod.DynamicMethod(), System.Reflection.Emit.DynamicMethod.DynamicMethod(), and System.Reflection.Emit.DynamicMethod.DynamicMethod().