Add FxVMFunctionCall class

- This replaces the general extensibility that had existed formerly
  in thingdef_function.cpp. Parameter parsing for function calls is
  shared with state parameter parsing. Functions are defined exactly in
  the same way as action functions, but without the 'action' keyword.
This commit is contained in:
Randy Heit 2014-12-30 23:31:07 -06:00
commit c6c2b21901
6 changed files with 243 additions and 97 deletions

View file

@ -459,16 +459,21 @@ static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls)
FName identifier = FName(sc.String);
if (sc.CheckToken('('))
{
FArgumentList *args = NULL;
FArgumentList *args = new FArgumentList;
PFunction *func = dyn_cast<PFunction>(cls->Symbols.FindSymbol(identifier, true));
try
{
if (!sc.CheckToken(')'))
if (func != NULL)
{
sc.UnGet();
ParseFunctionParameters(sc, cls, *args, func, "", NULL);
return new FxVMFunctionCall(func, args, sc);
}
else if (!sc.CheckToken(')'))
{
args = new FArgumentList;
do
{
args->Push(ParseExpressionM (sc, cls));
}
while (sc.CheckToken(','));
sc.MustGetToken(')');