Add return statements for DECORATE.

This commit is contained in:
Randy Heit 2016-02-05 16:34:17 -06:00
parent 1201ad0366
commit cb6504669d
3 changed files with 34 additions and 0 deletions

View File

@ -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);
};
//==========================================================================
//
//

View File

@ -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)
{

View File

@ -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);