|
@@ -3890,12 +3890,35 @@ public class JavaExpressionVisitor implements ExpressionVisitor<Void>, JavaNativ
|
3890
|
3890
|
|
3891
|
3891
|
@Override
|
3892
|
3892
|
public Void visitTryRethrowAsException(TryRethrowAsExceptionExpression expression) {
|
3893
|
|
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
3893
|
+ expression.value.accept(this);
|
|
3894
|
+ javaWriter.dup();
|
|
3895
|
+ //FIXME better way of finding the error
|
|
3896
|
+ final String internalName = context.getInternalName(expression.value.type) + "$Error";
|
|
3897
|
+ javaWriter.instanceOf(internalName);
|
|
3898
|
+ final Label end = new Label();
|
|
3899
|
+ javaWriter.ifNE(end);
|
|
3900
|
+ javaWriter.newObject(Type.getInternalName(Exception.class));
|
|
3901
|
+ javaWriter.dup();
|
|
3902
|
+ javaWriter.invokeSpecial(Type.getInternalName(Exception.class), "<init>", "()V");
|
|
3903
|
+ javaWriter.label(end);
|
|
3904
|
+ return null;
|
3894
|
3905
|
}
|
3895
|
3906
|
|
3896
|
3907
|
@Override
|
3897
|
3908
|
public Void visitTryRethrowAsResult(TryRethrowAsResultExpression expression) {
|
3898
|
|
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
|
3909
|
+ expression.value.accept(this);
|
|
3910
|
+ javaWriter.dup();
|
|
3911
|
+ //FIXME better way of finding the error
|
|
3912
|
+ final String internalName = context.getInternalName(expression.value.type) + "$Error";
|
|
3913
|
+ javaWriter.instanceOf(internalName);
|
|
3914
|
+ final Label end = new Label();
|
|
3915
|
+ javaWriter.ifNE(end);
|
|
3916
|
+ javaWriter.newObject(internalName);
|
|
3917
|
+ javaWriter.dupX1();
|
|
3918
|
+ javaWriter.swap();
|
|
3919
|
+ javaWriter.invokeSpecial(internalName, "<init>", "(Ljava/lang/Object;)V");
|
|
3920
|
+ javaWriter.label(end);
|
|
3921
|
+ return null;
|
3899
|
3922
|
}
|
3900
|
3923
|
|
3901
|
3924
|
@Override
|