StateMachineHelpers Module
Contains compiler intrinsics related to the definition of state machines.
Functions and values
Function or value |
Description
|
|
Indicates a named debug point arising from the context of inlined code.
Only a limited range of debug point names are supported.
If the debug point name is the empty string then the range used for the debug point will be
the range of the outermost expression prior to inlining.
If the debug point name is
|
|
|
|
Indicates to jump to a resumption point within resumable code. This may be the first statement in a MoveNextMethodImpl. The integer must be a valid resumption point within this resumable code.
|
Full Usage:
__stateMachine moveNextMethod setStateMachineMethod afterCode
Parameters:
MoveNextMethodImpl<'Data>
-
Gives the implementation of the MoveNext method on IAsyncStateMachine.
setStateMachineMethod : SetStateMachineMethodImpl<'Data>
-
Gives the implementation of the SetStateMachine method on IAsyncStateMachine.
afterCode : AfterCode<'Data, 'Result>
-
Gives code to execute after the generation of the state machine and to produce the final result.
Returns: 'Result
|
Statically generates a closure struct type based on ResumableStateMachine, At runtime an instance of the new struct type is populated and 'afterMethod' is called to consume it. At compile-time, the ResumableStateMachine type guides the generation of a new struct type by the F# compiler with closure-capture fields in a way similar to an object expression. Any mention of the ResumableStateMachine type in any the 'methods' is rewritten to this fresh struct type. The 'methods' are used to implement the interfaces on ResumableStateMachine and are also rewritten. The 'after' method is then executed and must eliminate the ResumableStateMachine. For example, its return type must not include ResumableStateMachine.
|
|
When used in a conditional, statically determines whether the 'then' branch represents valid resumable code and provides an alternative implementation if not.
|