add foreach k,v loop for maps

* make FxFunctionCall and FxMemberFunctionCall take a temporary for args, since they always move it
* fix type for cast
This commit is contained in:
Ricardo Luís Vaz Silva 2023-10-15 13:20:51 -03:00 committed by Rachael Alexanderson
commit c58bd6efb5
9 changed files with 230 additions and 20 deletions

View file

@ -477,7 +477,7 @@ static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls)
{
FArgumentList args;
args.Push(exp);
exp = new FxFunctionCall(NAME_ResolveState, NAME_None, args, sc);
exp = new FxFunctionCall(NAME_ResolveState, NAME_None, std::move(args), sc);
}
sc.MustGetToken(')');
return exp;
@ -512,7 +512,7 @@ static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls)
ParseFunctionParameters(sc, cls, args, func, "", nullptr);
}
// FxVMFunctionCall cannot be used here as it lacks some important checks
return new FxFunctionCall(identifier, NAME_None, args, sc);
return new FxFunctionCall(identifier, NAME_None, std::move(args), sc);
}
}
@ -543,7 +543,7 @@ static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls)
while (sc.CheckToken(','));
sc.MustGetToken(')');
}
return new FxFunctionCall(identifier, NAME_None, args, sc);
return new FxFunctionCall(identifier, NAME_None, std::move(args), sc);
}
}
else

View file

@ -578,7 +578,7 @@ FxExpression* ParseAction(FScanner &sc, FState state, FString statestring, Bagga
{
FArgumentList args;
ParseFunctionParameters(sc, bag.Info, args, afd, statestring, &bag.statedef);
call = new FxFunctionCall(symname, NAME_None, args, sc);
call = new FxFunctionCall(symname, NAME_None, std::move(args), sc);
return call;
}
sc.ScriptError("Invalid parameter '%s'\n", sc.String);