- tighten rules for action functions called from Decorate

FxVMFunctionCall (previously used to call action functions from Decorate) skipped self pointer compatibility checks

https://forum.zdoom.org/viewtopic.php?t=68678
This commit is contained in:
alexey.lysiuk 2020-06-07 15:00:32 +03:00
parent 5220a01070
commit 0e8473906e
2 changed files with 5 additions and 7 deletions

View file

@ -476,7 +476,7 @@ FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Bagg
// Otherwise, it's a sequence of actions. // Otherwise, it's a sequence of actions.
if (!sc.Compare("{")) if (!sc.Compare("{"))
{ {
FxVMFunctionCall *call = ParseAction(sc, state, statestring, bag); FxExpression *call = ParseAction(sc, state, statestring, bag);
endswithret = true; endswithret = true;
return new FxReturnStatement(call, sc); return new FxReturnStatement(call, sc);
} }
@ -560,14 +560,12 @@ FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Bagg
// //
//========================================================================== //==========================================================================
FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestring, Baggage &bag) FxExpression* ParseAction(FScanner &sc, FState state, FString statestring, Baggage &bag)
{ {
FxVMFunctionCall *call;
// Make the action name lowercase // Make the action name lowercase
strlwr (sc.String); strlwr (sc.String);
call = DoActionSpecials(sc, state, bag); FxExpression *call = DoActionSpecials(sc, state, bag);
if (call != NULL) if (call != NULL)
{ {
return call; return call;
@ -580,7 +578,7 @@ FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestring, B
{ {
FArgumentList args; FArgumentList args;
ParseFunctionParameters(sc, bag.Info, args, afd, statestring, &bag.statedef); ParseFunctionParameters(sc, bag.Info, args, afd, statestring, &bag.statedef);
call = new FxVMFunctionCall(new FxSelf(sc), afd, args, sc, false); call = new FxFunctionCall(symname, NAME_None, args, sc);
return call; return call;
} }
sc.ScriptError("Invalid parameter '%s'\n", sc.String); sc.ScriptError("Invalid parameter '%s'\n", sc.String);

View file

@ -196,7 +196,7 @@ void ParseStates(FScanner &sc, PClassActor *actor, AActor *defaults, Baggage &ba
void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression *> &out_params, void ParseFunctionParameters(FScanner &sc, PClassActor *cls, TArray<FxExpression *> &out_params,
PFunction *afd, FString statestring, FStateDefinitions *statedef); PFunction *afd, FString statestring, FStateDefinitions *statedef);
FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Baggage &bag, bool &endswithret); FxExpression *ParseActions(FScanner &sc, FState state, FString statestring, Baggage &bag, bool &endswithret);
class FxVMFunctionCall *ParseAction(FScanner &sc, FState state, FString statestring, Baggage &bag); FxExpression *ParseAction(FScanner &sc, FState state, FString statestring, Baggage &bag);
FName CheckCastKludges(FName in); FName CheckCastKludges(FName in);
void SetImplicitArgs(TArray<PType *> *args, TArray<uint32_t> *argflags, TArray<FName> *argnames, PContainerType *cls, uint32_t funcflags, int useflags); void SetImplicitArgs(TArray<PType *> *args, TArray<uint32_t> *argflags, TArray<FName> *argnames, PContainerType *cls, uint32_t funcflags, int useflags);
PFunction *CreateAnonymousFunction(PContainerType *containingclass, PType *returntype, int flags); PFunction *CreateAnonymousFunction(PContainerType *containingclass, PType *returntype, int flags);