You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
__ctx__ is a context of state machine (holds current variable values and other data)
${id} is a unique id for current transformation
Preprocessed into:
//This line indicates that next state should be executed inside of a `try...catch` to handle exceptions; //and `@state @catchBegin ${id}` is a state which should be executed on exception__ctx__.enterTry(@state @catchBegin ${id});
//this line finishes current state and advances state machine to specified state
@goto @tryBegin ${id};
//this line indicates that a new state starts here. In the end it will be replaced with `case ${id}:`
@label @tryBegin ${id}
//actual code of `try` blockdoSomething();
//this line indicates that exception handling should be turned off now.__ctx__.leaveTry();
//if we reached this line, it means there were no exceptions, and we should skip `catch` and go to the line after last `catch` block.
@goto @tryCatchEnd ${id}
//this line indicates a start of a state with `catch` blocks
@label @catchBegin ${id}
//each catch is transformed to a type checking of caught exception//transforming `if`s is a topic for another transformation.if(Std.is(__ctx__.exception, String)) {
catchString();
} elseif(Std.is(__ctx__.exception, Int)) {
catchInt();
} else {
catchDynamic();
//if no `catch(e:Dynamic)` is defined in user code, then this block is replaced with//__ctx__.notCaught()//which rethrows exception if current context is not awaited or propagates exception to a caller context otherwise
}
//indicates a start of next state
@label @tryCatchEnd ${id}
//some cleanup if needed__ctx__.leaveTryCatch();
The text was updated successfully, but these errors were encountered:
It's pretty much the same as your snippet, except try..catch is not getenerated, but state machine is executed inside of a try...catch instead when entering corresponding state.
Source
Short legend for next snippet:
__ctx__
is a context of state machine (holds current variable values and other data)${id}
is a unique id for current transformationPreprocessed into:
The text was updated successfully, but these errors were encountered: