[] → []
0x8f
0 → 0
7
This action defines "soft" regions. You can freely jump or fall-through at the
end of each block and continue execution. The finally
block or actions beyond
the Try
actions are not executed automatically: you have to jump or
fall-through there manually. (TODO: I don't remember exactly how it behaves
around return
).
When you first enter the try
region, the throw checks are enabled. They are
disabled once you leave the try
region. They are not re-enabled if you jump
out and then back in the try
region. If an exception is thrown and the checks
are enabled, then the recovery is triggered, moving the instruction pointer
to the catch
region (or finally
region if there is no catch
).
If there is no catch
or finally
, the recovery does not happen: the error
bubbles up, the instruction pointer is not moved after the Try
action.
ActionTry defines handlers for exceptional conditions, implementing the ActionScript try, catch, and finally keywords.
Field | Type | Comment |
---|---|---|
ActionTry | ACTIONRECORDHEADER | ActionCode = 0x8F |
Reserved | UB[5] | Always zero |
CatchInRegisterFlag | UB[1] |
0 - Do not put caught object into register (insteadstore in named variable) 1 - Put caught object into register (do not store in named variable) |
FinallyBlockFlag | UB[1] |
0 - No finally block 1 - Has finally block |
CatchBlockFlag | UB[1] |
0 - No catch block 1 - Has catch block |
TrySize | UI16 | Length of the try block |
CatchSize | UI16 | Length of the catch block |
FinallySize | UI16 | Length of the finally block |
CatchName | If CatchInRegisterFlag = 0, STRING | Name of the catch variable |
CatchRegister | If CatchInRegisterFlag = 1, UI8 | Register to catch into |
TryBody | UI8[TrySize] | Body of the try block |
CatchBody | UI8[CatchSize] | Body of the catch block, if any |
FinallyBody | UI8[FinallySize] | Body of the finally block, if any |
The CatchSize and FinallySize fields always exist, whether or not the CatchBlockFlag or FinallyBlockFlag settings are 1. The try, catch, and finally blocks do not use end tags to mark the end of their respective blocks. Instead, the length of a block is set by the TrySize, CatchSize, and FinallySize values.