Generate exception handlers for the body.
Generate exception handlers for the body. Body is evaluated with a context where all the handlers are active. Handlers are evaluated in the 'outer' context.
It returns the resulting context, with the same active handlers as before the call. Use it like:
ctx.Try( ctx => {
ctx.bb.emit(...) // protected block
}, (ThrowableClass,
ctx => {
ctx.bb.emit(...); // exception handler
}), (AnotherExceptionClass,
ctx => {...
} ))
try-catch-finally blocks are actually simpler to emit in MSIL, because there
is support for finally
in bytecode.
try-catch-finally blocks are actually simpler to emit in MSIL, because there
is support for finally
in bytecode.
A try { .. } catch { .. } finally { .. } block is de-sugared into try { try { ..} catch { .. } } finally { .. }
In ICode finally
block is represented exactly the same as an exception handler,
but with NoSymbol
as the exception class. The covered blocks are all blocks of
the try { .. } catch { .. }
.
Also, TryMsil does not enter any Finalizers into the cleanups', because the
CLI takes care of running the finalizer when seeing a
leave' statement inside
a try / catch.
The current basic block.
The current class.
The current monitors or finalizers, to be cleaned up upon return'.
The exception handlers we are currently generating code for
Current method definition.
Clone the current context
Prepare a new context upon entry into a method.
Prepare a new context upon entry into a method.
...
...
...
current exception handlers
Map from label symbols to label objects.
Make a fresh local variable.
Make a fresh local variable. It ensures the 'name' is unique.
The current method.
Return a new context for a new basic block.
The current package.
Remove the given handler from the list of active exception handlers.
The current local variable scope.
The Context class keeps information relative to the current state in code generation