Ejemplo n.º 1
0
 public void createBCode(CodeGeneration gen) {
   super.createBCode(gen);
   if (hasResult()) {
     TypeDecl type = null;
     BodyDecl b = enclosingBodyDecl();
     if (b instanceof MethodDecl) {
       type = ((MethodDecl) b).type();
     } else {
       throw new Error("Can not create code that returns value within non method");
     }
     getResult().createBCode(gen);
     getResult().type().emitCastTo(gen, type);
     if (!finallyList().isEmpty()) {
       type.emitStoreLocal(gen, resultSaveLocalNum());
     }
     for (Iterator iter = finallyList().iterator(); iter.hasNext(); ) {
       FinallyHost stmt = (FinallyHost) iter.next();
       gen.emitJsr(stmt.label_finally_block());
     }
     if (!finallyList().isEmpty()) {
       type.emitLoadLocal(gen, resultSaveLocalNum());
     }
     type.emitReturn(gen);
   } else {
     for (Iterator iter = finallyList().iterator(); iter.hasNext(); ) {
       FinallyHost stmt = (FinallyHost) iter.next();
       gen.emitJsr(stmt.label_finally_block());
     }
     gen.emitReturn();
   }
 }
Ejemplo n.º 2
0
 private boolean isDUafterReachedFinallyBlocks_compute(Variable v) {
   if (!isDUbefore(v) && finallyList().isEmpty()) return false;
   for (Iterator iter = finallyList().iterator(); iter.hasNext(); ) {
     FinallyHost f = (FinallyHost) iter.next();
     if (!f.isDUafterFinally(v)) return false;
   }
   return true;
 }