mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Added some warnings for nullable(T) usage
This commit is contained in:
parent
da29d695dd
commit
4b2256d41e
1 changed files with 16 additions and 5 deletions
|
@ -7228,11 +7228,22 @@ BfType* BfModule::ResolveTypeRef(BfTypeReference* typeRef, BfPopulateType popula
|
||||||
typeVec.push_back(resolvedType);
|
typeVec.push_back(resolvedType);
|
||||||
resolvedType = ResolveTypeDef(mCompiler->mNullableTypeDef, typeVec, BfPopulateType_Declaration);
|
resolvedType = ResolveTypeDef(mCompiler->mNullableTypeDef, typeVec, BfPopulateType_Declaration);
|
||||||
}
|
}
|
||||||
else if ((resolvedType != NULL) && (resolvedType->IsValueType()))
|
else if (resolvedType != NULL)
|
||||||
{
|
{
|
||||||
BfTypeVector typeVec;
|
if (resolvedType->IsValueType())
|
||||||
typeVec.push_back(resolvedType);
|
{
|
||||||
resolvedType = ResolveTypeDef(mCompiler->mNullableTypeDef, typeVec, BfPopulateType_Declaration);
|
if (InDefinitionSection())
|
||||||
|
Warn(0, StrFormat("Consider using '%s?' instead of nullable modifier", TypeToString(resolvedType).c_str()), retTypeTypeRef);
|
||||||
|
|
||||||
|
BfTypeVector typeVec;
|
||||||
|
typeVec.push_back(resolvedType);
|
||||||
|
resolvedType = ResolveTypeDef(mCompiler->mNullableTypeDef, typeVec, BfPopulateType_Declaration);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (InDefinitionSection())
|
||||||
|
Warn(0, StrFormat("Unneeded nullable modifier, %s is already nullable", TypeToString(resolvedType).c_str()), retTypeTypeRef->mRetTypeToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (resolvedType != NULL)
|
if (resolvedType != NULL)
|
||||||
PopulateType(resolvedType, populateType);
|
PopulateType(resolvedType, populateType);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue