コード例 #1
0
            // ReSharper restore InconsistentNaming

            public MoveNextTransformation(AsyncStateMachineAspectWeaver parent)
                : base(parent)
            {
                ModuleDeclaration module = parent.Module;

                // ReSharper disable InconsistentNaming
                IType actor_Type = (IType)module.FindType(typeof(Actor), BindingOptions.Default);

                this.actor_GetDispatcher_Method = module.FindMethod(actor_Type, "get_Dispatcher");


                IType dispatcher_Type = (IType)module.FindType(typeof(IDispatcher), BindingOptions.Default);

                this.dispatcher_CheckAccess_Method = module.FindMethod(dispatcher_Type, "CheckAccess");
                this.dispatcher_getSynchronizationContext_Method = module.FindMethod(dispatcher_Type, "get_SynchronizationContext");

                IType task_Type = (IType)module.FindType(typeof(Task), BindingOptions.Default);

                this.task_Yield_Method = module.FindMethod(task_Type, "Yield", 0);

                IType yieldAwaitable_Type = (IType)module.FindType("System.Runtime.CompilerServices.YieldAwaitable, mscorlib", BindingOptions.Default);

                this.yieldAwaitable_GetAwaiter_Method = module.FindMethod(yieldAwaitable_Type, "GetAwaiter");

                this.yieldAwaiter_Type = (IType)this.yieldAwaitable_GetAwaiter_Method.ReturnType;

                this.asyncVoidMethodBuilder_Type = (IType)module.FindType("System.Runtime.CompilerServices.AsyncVoidMethodBuilder, mscorlib",
                                                                          BindingOptions.Default);
                this.asyncVoidMethodBuilder_AwaitUnsafeOnCompleted_Method = module.FindMethod(this.asyncVoidMethodBuilder_Type, "AwaitUnsafeOnCompleted");

                this.asyncTaskMethodBuilder_Type = (IType)module.FindType("System.Runtime.CompilerServices.AsyncTaskMethodBuilder, mscorlib",
                                                                          BindingOptions.Default);
                this.asyncTaskMethodBuilder_AwaitUnsafeOnCompleted_Method = module.FindMethod(this.asyncTaskMethodBuilder_Type, "AwaitUnsafeOnCompleted");

                this.asyncTaskMethodBuilderGenericType = (IType)module.FindType("System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1, mscorlib",
                                                                                BindingOptions.Default);
                this.asyncTaskMethodBuilderGeneric_AwaitUnsafeOnCompleted_Method = module.FindMethod(this.asyncTaskMethodBuilderGenericType,
                                                                                                     "AwaitUnsafeOnCompleted");

                this.synchronizationContext_Type = (IType)module.FindType(typeof(SynchronizationContext), BindingOptions.Default);
                this.synchronizationContext_getCurrent_Method = module.FindMethod(this.synchronizationContext_Type, "get_Current");
                this.synchronizationContext_SetSynchronizationContext_Method = module.FindMethod(this.synchronizationContext_Type, "SetSynchronizationContext");


                // ReSharper restore InconsistentNaming
            }
コード例 #2
0
 public AsyncStateMachineAspectWeaverInstance(AsyncStateMachineAspectWeaver parent, AspectInstanceInfo aspectInstanceInfo) :
     base(parent, aspectInstanceInfo)
 {
     this.parent             = parent;
     this.aspectInstanceInfo = aspectInstanceInfo;
 }