mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
EnumType.UnderlyingType
support, generic enum constraint improvements
This commit is contained in:
parent
64161bf001
commit
1ee0a19bbf
5 changed files with 74 additions and 2 deletions
|
@ -676,6 +676,9 @@ const char* BfAutoComplete::GetTypeName(BfType* type)
|
|||
|
||||
void BfAutoComplete::AddInnerTypes(BfTypeInstance* typeInst, const StringImpl& filter, bool allowProtected, bool allowPrivate)
|
||||
{
|
||||
if (typeInst->IsEnum())
|
||||
AddEntry(AutoCompleteEntry("valuetype", "UnderlyingType"), filter);
|
||||
|
||||
for (auto innerType : typeInst->mTypeDef->mNestedTypes)
|
||||
{
|
||||
if (CheckProtection(innerType->mProtection, innerType, allowProtected, allowPrivate))
|
||||
|
@ -847,7 +850,7 @@ void BfAutoComplete::AddTypeMembers(BfTypeInstance* typeInst, bool addStatic, bo
|
|||
|
||||
if ((addStatic) && (mModule->mCurMethodInstance == NULL) && (typeInst->IsEnum()))
|
||||
{
|
||||
AddEntry(AutoCompleteEntry("valuetype", "_"), filter);
|
||||
AddEntry(AutoCompleteEntry("value", "_"), filter);
|
||||
}
|
||||
|
||||
#define CHECK_STATIC(staticVal) ((staticVal && addStatic) || (!staticVal && addNonStatic))
|
||||
|
@ -1847,6 +1850,17 @@ bool BfAutoComplete::CheckMemberReference(BfAstNode* target, BfAstNode* dotToken
|
|||
checkType = genericParamInstance->mTypeConstraint;
|
||||
else
|
||||
checkType = mModule->mContext->mBfObjectType;
|
||||
|
||||
if ((genericParamInstance->IsEnum()))
|
||||
{
|
||||
if (isStatic)
|
||||
AddEntry(AutoCompleteEntry("valuetype", "UnderlyingType"), filter);
|
||||
else
|
||||
{
|
||||
AddEntry(AutoCompleteEntry("value", "Underlying"), filter);
|
||||
AddEntry(AutoCompleteEntry("value", "UnderlyingRef"), filter);
|
||||
}
|
||||
}
|
||||
};
|
||||
_HandleGenericParamInstance(genericParamInstance);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue