Merge remote-tracking branch 'remotes/origin/master' into new_level_refactor

This commit is contained in:
Christoph Oelckers 2019-02-01 17:59:25 +01:00
commit edb34b9f7f

View file

@ -2772,6 +2772,8 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
}
}
VMFunction *newfunc = nullptr;
if (!(f->Flags & ZCC_Native))
{
if (f->Body == nullptr)
@ -2784,7 +2786,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
auto code = ConvertAST(c->Type(), f->Body);
if (code != nullptr)
{
FunctionBuildList.AddFunction(OutNamespace, mVersion, sym, code, FStringf("%s.%s", c->Type()->TypeName.GetChars(), FName(f->Name).GetChars()), false, -1, 0, Lump);
newfunc = FunctionBuildList.AddFunction(OutNamespace, mVersion, sym, code, FStringf("%s.%s", c->Type()->TypeName.GetChars(), FName(f->Name).GetChars()), false, -1, 0, Lump);
}
}
}
@ -2864,6 +2866,16 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
sym->Variants[0].Implementation->DefaultArgs = parentfunc->Variants[0].Implementation->DefaultArgs;
sym->Variants[0].ArgFlags = parentfunc->Variants[0].ArgFlags;
}
// Update argument flags for VM function if needed as their list could be incomplete
// At the moment of function creation, arguments with default values were not copied yet from the parent function
if (newfunc != nullptr && sym->Variants[0].ArgFlags.Size() != newfunc->ArgFlags.Size())
{
for (unsigned i = newfunc->ArgFlags.Size(), count = sym->Variants[0].ArgFlags.Size(); i < count; ++i)
{
newfunc->ArgFlags.Push(sym->Variants[0].ArgFlags[i]);
}
}
}
}
else