| 6425 | } |
| 6426 | |
| 6427 | void genCode(CppiaCompiler *compiler, const JitVal &inDest, ExprType destType) HXCPP_OVERRIDE |
| 6428 | { |
| 6429 | ThrowList thisThrown; |
| 6430 | ThrowList *oldList = compiler->pushCatching(&thisThrown); |
| 6431 | body->genCode(compiler, inDest, destType); |
| 6432 | |
| 6433 | compiler->popCatching(oldList); |
| 6434 | |
| 6435 | if (thisThrown.size()>0) |
| 6436 | { |
| 6437 | std::vector<JumpId> handledExceptions; |
| 6438 | |
| 6439 | JumpId noThrow = compiler->jump(); |
| 6440 | |
| 6441 | for(int i=0;i<thisThrown.size();i++) |
| 6442 | compiler->comeFrom(thisThrown[i]); |
| 6443 | |
| 6444 | for(int i=0;i<catches.size();i++) |
| 6445 | { |
| 6446 | Catch &c = catches[i]; |
| 6447 | compiler->callNative( (void *)isExceptionCatch, sJitCtx.star(jtPointer,offsetof(hx::StackContext,exception)), c.type ); |
| 6448 | JumpId notThisOne = compiler->compare(cmpI_EQUAL, sJitReturnReg, (int)0); |
| 6449 | |
| 6450 | // Exception is this type |
| 6451 | ExprType type = c.var.expressionType; |
| 6452 | compiler->convert( sJitCtx.star(jtPointer,offsetof(hx::StackContext,exception)), etObject, |
| 6453 | JitFramePos(c.var.stackPos,getJitType(type)), type ); |
| 6454 | compiler->move(sJitCtx.star(jtPointer,offsetof(hx::StackContext,exception)),(void *)0); |
| 6455 | |
| 6456 | c.body->genCode(compiler, inDest, destType); |
| 6457 | |
| 6458 | handledExceptions.push_back( compiler->jump() ); |
| 6459 | compiler->comeFrom(notThisOne); |
| 6460 | } |
| 6461 | |
| 6462 | // Unhandled - go to next handler or return |
| 6463 | //if (compiler->hasCatching()) |
| 6464 | compiler->addThrow(); |
| 6465 | // Optimization |
| 6466 | //else compiler->addReturn(); |
| 6467 | |
| 6468 | // handled/not thrown |
| 6469 | for(int i=0;i<handledExceptions.size();i++) |
| 6470 | compiler->comeFrom( handledExceptions[i] ); |
| 6471 | compiler->comeFrom(noThrow); |
| 6472 | } |
| 6473 | } |
| 6474 | #endif |
| 6475 | }; |
| 6476 |
nothing calls this directly
no test coverage detected