mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +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);
|
||||
resolvedType = ResolveTypeDef(mCompiler->mNullableTypeDef, typeVec, BfPopulateType_Declaration);
|
||||
}
|
||||
else if ((resolvedType != NULL) && (resolvedType->IsValueType()))
|
||||
{
|
||||
BfTypeVector typeVec;
|
||||
typeVec.push_back(resolvedType);
|
||||
resolvedType = ResolveTypeDef(mCompiler->mNullableTypeDef, typeVec, BfPopulateType_Declaration);
|
||||
else if (resolvedType != NULL)
|
||||
{
|
||||
if (resolvedType->IsValueType())
|
||||
{
|
||||
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)
|
||||
PopulateType(resolvedType, populateType);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue