generator.endTryBlock();
final Expression finallyBlock = node.getFinallyBlock();
final Type tryType = expr.getType();
final LocalBuilder value;
if (tryType != PrimitiveTypes.Void) {
//
// Store the value of the try body.
//
value = getLocal(tryType);
generator.emitStore(value);
}
else {
value = null;
}
if (finallyBlock != null) {
emitExpression(finallyBlock);
}
//
// Emit the catch blocks.
//
for (final CatchBlock cb : node.getHandlers()) {
pushLabelBlock(LabelScopeKind.Catch);
//
// Begin the strongly typed exception block.
//
if (cb.getFilter() == null) {
generator.beginCatchBlock(cb.getTest());
}
else {
throw new UnsupportedOperationException("Filter blocks are not yet supported");
// generator.beginExceptFilterBlock();
}
enterScope(cb);
emitCatchStart(cb);
//
// Emit the catch block body.
//
emitExpression(cb.getBody());
if (tryType != PrimitiveTypes.Void) {
//
// Store the value of the catch block body.
//
generator.emitStore(value);
}
if (finallyBlock != null) {
emitExpression(finallyBlock);
}
exitScope(cb);
popLabelBlock(LabelScopeKind.Catch);
}
//
// Emit the finally block.
//
if (finallyBlock != null) {
pushLabelBlock(LabelScopeKind.Finally);
generator.beginFinallyBlock();
final LocalBuilder exceptionTemp = getLocal(Types.Throwable);
generator.emitStore(exceptionTemp);
//
// Emit the body.