Fixes for newer GCC version.

This commit is contained in:
Lucas de Vries
2018-07-17 16:21:11 +02:00
parent badcf74513
commit b19a4c613d
3 changed files with 10 additions and 5 deletions
+4 -1
View File
@@ -5673,7 +5673,10 @@ asCTypeInfo *asCBuilder::GetType(const char *type, asSNameSpace *ns, asCObjectTy
asCObjectType *asCBuilder::GetObjectType(const char *type, asSNameSpace *ns)
{
return GetType(type, ns, 0)->CastToObjectType();
auto* typeInfo = GetType(type, ns, 0);
if(!typeInfo)
return nullptr;
return typeInfo->CastToObjectType();
}
#ifndef AS_NO_COMPILER
+5 -3
View File
@@ -6155,7 +6155,8 @@ asUINT asCCompiler::ImplicitConvObjectToPrimitive(asCExprContext *ctx, const asC
// Find matching value cast behaviours
// Here we're only interested in those that convert the type to a primitive type
asCArray<int> funcs;
asCObjectType *ot = ctx->type.dataType.GetTypeInfo()->CastToObjectType();
auto *typeInfo = ctx->type.dataType.GetTypeInfo();
asCObjectType *ot = typeInfo ? typeInfo->CastToObjectType() : 0;
if( ot == 0 )
{
if( convType != asIC_IMPLICIT_CONV && node )
@@ -6467,7 +6468,8 @@ asUINT asCCompiler::ImplicitConvObjectValue(asCExprContext *ctx, const asCDataTy
if( to.GetTypeInfo() != ctx->type.dataType.GetTypeInfo() )
{
// TODO: Implement support for implicit constructor/factory
asCObjectType *ot = ctx->type.dataType.GetTypeInfo()->CastToObjectType();
auto* typeInfo =ctx->type.dataType.GetTypeInfo();
asCObjectType *ot = typeInfo ? typeInfo->CastToObjectType() : 0;
if( ot == 0 )
return cost;
@@ -8827,7 +8829,7 @@ int asCCompiler::CompileVariableAccess(const asCString &name, const asCString &s
if( currScope != "" && currScope != "::" )
{
builder->GetNameSpaceByString(currScope, outFunc->objectType ? outFunc->objectType->nameSpace : outFunc->nameSpace, errNode, script, &scopeType, false);
if (scopeType->CastToEnumType() == 0)
if (scopeType && scopeType->CastToEnumType() == 0)
scopeType = 0;
}
@@ -6269,7 +6269,7 @@ void asCScriptEngine::DestroySubList(asBYTE *&buffer, asSListPatternNode *&node)
dt = GetDataTypeFromTypeId(typeId);
}
asCObjectType *ot = dt.GetTypeInfo()->CastToObjectType();
asCObjectType *ot = (asCObjectType*)dt.GetTypeInfo();
if( ot && (ot->flags & asOBJ_ENUM) == 0 )
{
// Free all instances of this type