Merge branch 'master' into asmjit

# Conflicts:
#	src/p_actionfunctions.cpp
This commit is contained in:
Christoph Oelckers 2018-11-18 21:08:16 +01:00
commit 8bc2d50ad2
6 changed files with 29 additions and 28 deletions

View file

@ -8140,12 +8140,17 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
}
if (isDynArrayObj && ((MethodName == NAME_Push && idx == 0) || (MethodName == NAME_Insert && idx == 1)))
{
// The DynArray_Obj declaration in dynarrays.txt doesn't support generics yet. Check the type here as if it did.
if (!static_cast<PObjectPointer*>(elementType)->PointedClass()->IsAncestorOf(static_cast<PObjectPointer*>(a->ValueType)->PointedClass()))
// Null pointers are always valid.
if (!a->isConstant() || static_cast<FxConstant*>(a)->GetValue().GetPointer() != nullptr)
{
ScriptPosition.Message(MSG_ERROR, "Type mismatch in function argument");
delete this;
return nullptr;
// The DynArray_Obj declaration in dynarrays.txt doesn't support generics yet. Check the type here as if it did.
if (!a->ValueType->isObjectPointer() ||
!static_cast<PObjectPointer*>(elementType)->PointedClass()->IsAncestorOf(static_cast<PObjectPointer*>(a->ValueType)->PointedClass()))
{
ScriptPosition.Message(MSG_ERROR, "Type mismatch in function argument");
delete this;
return nullptr;
}
}
}
if (a->IsDynamicArray())