int exception_to_rethrow = _block->newTemp();
_block->TRY(tryBody, catchBody,
- ast->catchExpression ? ast->catchExpression->name.toString() : QString(),
+ _function->newString(ast->catchExpression ? ast->catchExpression->name.toString() : QString()),
_block->TEMP(exception_to_rethrow));
_block = tryBody;
generateFunctionCall(Assembler::ReturnValueRegister, tryWrapper, Assembler::ContextRegister, Assembler::LocalsRegister,
Assembler::ReentryBlock(t->tryBlock), Assembler::ReentryBlock(t->catchBlock),
- identifier(t->exceptionVarName), Assembler::PointerToValue(t->exceptionVar));
+ identifier(*t->exceptionVarName), Assembler::PointerToValue(t->exceptionVar));
_as->jump(Assembler::ReturnValueRegister);
}
Instruction::EnterTry enterTry;
enterTry.tryOffset = 0;
enterTry.catchOffset = 0;
- enterTry.exceptionVarName = identifier(t->exceptionVarName);
+ enterTry.exceptionVarName = identifier(*t->exceptionVarName);
enterTry.exceptionVar = getParam(t->exceptionVar);
ptrdiff_t enterTryLoc = addInstruction(enterTry);
return s;
}
-Stmt *BasicBlock::TRY(BasicBlock *tryBlock, BasicBlock *catchBlock, const QString &exceptionVarName, Temp *exceptionVar)
+Stmt *BasicBlock::TRY(BasicBlock *tryBlock, BasicBlock *catchBlock, const QString *exceptionVarName, Temp *exceptionVar)
{
if (isTerminated())
return 0;
struct Try: Stmt {
BasicBlock *tryBlock;
BasicBlock *catchBlock;
- QString exceptionVarName;
+ const QString *exceptionVarName;
Temp *exceptionVar; // place to store the caught exception, for use when re-throwing
- void init(BasicBlock *tryBlock, BasicBlock *catchBlock, const QString &exceptionVarName, Temp *exceptionVar)
+ void init(BasicBlock *tryBlock, BasicBlock *catchBlock, const QString *exceptionVarName, Temp *exceptionVar)
{
this->tryBlock = tryBlock;
this->catchBlock = catchBlock;
Stmt *JUMP(BasicBlock *target);
Stmt *CJUMP(Expr *cond, BasicBlock *iftrue, BasicBlock *iffalse);
Stmt *RET(Temp *expr);
- Stmt *TRY(BasicBlock *tryBlock, BasicBlock *catchBlock, const QString &exceptionVarName, Temp *exceptionVar);
+ Stmt *TRY(BasicBlock *tryBlock, BasicBlock *catchBlock, const QString *exceptionVarName, Temp *exceptionVar);
void dump(QTextStream &out, Stmt::Mode mode = Stmt::HIR);