mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Add return statements for DECORATE.
This commit is contained in:
parent
1201ad0366
commit
cb6504669d
3 changed files with 34 additions and 0 deletions
|
@ -892,6 +892,19 @@ public:
|
|||
ExpEmit Emit(VMFunctionBuilder *build, bool tailcall);
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FxReturnStatement
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
class FxReturnStatement : public FxTailable
|
||||
{
|
||||
public:
|
||||
FxReturnStatement(const FScriptPosition &pos);
|
||||
ExpEmit Emit(VMFunctionBuilder *build, bool tailcall);
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -3484,6 +3484,21 @@ ExpEmit FxIfStatement::Emit(VMFunctionBuilder *build, bool tailcall)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FxReturnStatement::FxReturnStatement(const FScriptPosition &pos)
|
||||
: FxTailable(pos)
|
||||
{
|
||||
}
|
||||
|
||||
ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build, bool tailcall)
|
||||
{
|
||||
build->Emit(OP_RET, RET_FINAL, REGT_NIL, 0);
|
||||
return ExpEmit();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FxClassTypeCast::FxClassTypeCast(const PClass *dtype, FxExpression *x)
|
||||
: FxExpression(x->ScriptPosition)
|
||||
{
|
||||
|
|
|
@ -386,6 +386,12 @@ FxTailable *ParseActions(FScanner &sc, FState state, FString statestring, Baggag
|
|||
}
|
||||
add = new FxIfStatement(cond, true_part, false_part, sc);
|
||||
}
|
||||
else if (sc.Compare("return"))
|
||||
{ // Handle a return statement
|
||||
sc.MustGetStringName(";");
|
||||
sc.MustGetString();
|
||||
add = new FxReturnStatement(sc);
|
||||
}
|
||||
else
|
||||
{ // Handle a regular action function call
|
||||
add = ParseAction(sc, state, statestring, bag);
|
||||
|
|
Loading…
Reference in a new issue