mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- fixed: For named functions the prototype needs to be set before the code generator starts resolving. Otherwise it will crash on incompletely set up forward declarations.
This commit is contained in:
parent
f8ccda2dc8
commit
a652c5f259
1 changed files with 12 additions and 2 deletions
|
@ -673,6 +673,13 @@ VMFunction *FFunctionBuildList::AddFunction(PFunction *functype, FxExpression *c
|
|||
it.Function->ImplicitArgs = functype->GetImplicitArgs();
|
||||
it.Proto = nullptr;
|
||||
it.FromDecorate = fromdecorate;
|
||||
|
||||
// set prototype for named functions.
|
||||
if (it.Func->SymbolName != NAME_None)
|
||||
{
|
||||
it.Function->Proto = it.Func->Variants[0].Proto;
|
||||
}
|
||||
|
||||
mItems.Push(it);
|
||||
return it.Function;
|
||||
}
|
||||
|
@ -714,10 +721,13 @@ void FFunctionBuildList::Build()
|
|||
{
|
||||
assert(item.Proto != nullptr);
|
||||
|
||||
// Generate prototype for this anonymous function
|
||||
// Generate prototype for anonymous functions.
|
||||
VMScriptFunction *sfunc = item.Function;
|
||||
// create a new prototype from the now known return type and the argument list of the function's template prototype.
|
||||
if (sfunc->Proto == nullptr)
|
||||
{
|
||||
sfunc->Proto = NewPrototype(item.Proto->ReturnTypes, item.Func->Variants[0].Proto->ArgumentTypes);
|
||||
}
|
||||
|
||||
// Emit code
|
||||
item.Code->Emit(&buildit);
|
||||
|
|
Loading…
Reference in a new issue