ETModel_ETTask_Binding.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Runtime.InteropServices;
  6. using ILRuntime.CLR.TypeSystem;
  7. using ILRuntime.CLR.Method;
  8. using ILRuntime.Runtime.Enviorment;
  9. using ILRuntime.Runtime.Intepreter;
  10. using ILRuntime.Runtime.Stack;
  11. using ILRuntime.Reflection;
  12. using ILRuntime.CLR.Utils;
  13. namespace ILRuntime.Runtime.Generated
  14. {
  15. unsafe class ETModel_ETTask_Binding
  16. {
  17. public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
  18. {
  19. BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
  20. MethodBase method;
  21. Type[] args;
  22. Type type = typeof(ETModel.ETTask);
  23. args = new Type[]{};
  24. method = type.GetMethod("GetAwaiter", flag, null, args, null);
  25. app.RegisterCLRMethodRedirection(method, GetAwaiter_0);
  26. app.RegisterCLRCreateDefaultInstance(type, () => new ETModel.ETTask());
  27. }
  28. static void WriteBackInstance(ILRuntime.Runtime.Enviorment.AppDomain __domain, StackObject* ptr_of_this_method, IList<object> __mStack, ref ETModel.ETTask instance_of_this_method)
  29. {
  30. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  31. switch(ptr_of_this_method->ObjectType)
  32. {
  33. case ObjectTypes.Object:
  34. {
  35. __mStack[ptr_of_this_method->Value] = instance_of_this_method;
  36. }
  37. break;
  38. case ObjectTypes.FieldReference:
  39. {
  40. var ___obj = __mStack[ptr_of_this_method->Value];
  41. if(___obj is ILTypeInstance)
  42. {
  43. ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
  44. }
  45. else
  46. {
  47. var t = __domain.GetType(___obj.GetType()) as CLRType;
  48. t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
  49. }
  50. }
  51. break;
  52. case ObjectTypes.StaticFieldReference:
  53. {
  54. var t = __domain.GetType(ptr_of_this_method->Value);
  55. if(t is ILType)
  56. {
  57. ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
  58. }
  59. else
  60. {
  61. ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
  62. }
  63. }
  64. break;
  65. case ObjectTypes.ArrayReference:
  66. {
  67. var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as ETModel.ETTask[];
  68. instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
  69. }
  70. break;
  71. }
  72. }
  73. static StackObject* GetAwaiter_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
  74. {
  75. ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
  76. StackObject* ptr_of_this_method;
  77. StackObject* __ret = ILIntepreter.Minus(__esp, 1);
  78. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  79. ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
  80. ETModel.ETTask instance_of_this_method = (ETModel.ETTask)typeof(ETModel.ETTask).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
  81. var result_of_this_method = instance_of_this_method.GetAwaiter();
  82. ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
  83. WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);
  84. __intp.Free(ptr_of_this_method);
  85. return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
  86. }
  87. }
  88. }