mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed constExprs with ints, hover for enum values, _ for enums
This commit is contained in:
parent
4087bf8e2a
commit
4dcd7f9c6a
21 changed files with 293 additions and 142 deletions
|
@ -460,6 +460,9 @@ void BfAutoComplete::AddMethod(BfMethodDeclaration* methodDecl, const StringImpl
|
|||
|
||||
void BfAutoComplete::AddTypeDef(BfTypeDef* typeDef, const StringImpl& filter, bool onlyAttribute)
|
||||
{
|
||||
if (typeDef->mTypeDeclaration == NULL)
|
||||
return;
|
||||
|
||||
StringT<64> name(typeDef->mName->ToString());
|
||||
if (name == "@")
|
||||
return;
|
||||
|
@ -576,6 +579,11 @@ void BfAutoComplete::AddTypeMembers(BfTypeInstance* typeInst, bool addStatic, bo
|
|||
|
||||
auto activeTypeDef = mModule->GetActiveTypeDef();
|
||||
|
||||
if ((addStatic) && (mModule->mCurMethodInstance == NULL) && (typeInst->IsEnum()))
|
||||
{
|
||||
AddEntry(AutoCompleteEntry("valuetype", "_"), filter);
|
||||
}
|
||||
|
||||
#define CHECK_STATIC(staticVal) ((staticVal && addStatic) || (!staticVal && addNonStatic))
|
||||
|
||||
mModule->PopulateType(typeInst, BfPopulateType_Data);
|
||||
|
@ -2178,13 +2186,41 @@ void BfAutoComplete::CheckVarResolution(BfAstNode* varTypeRef, BfType* resolvedT
|
|||
}
|
||||
}
|
||||
|
||||
if (mResolveType == BfResolveType_GetVarType)
|
||||
if (mResolveType == BfResolveType_GetResultString)
|
||||
{
|
||||
mVarTypeName = mModule->TypeToString(resolvedType);
|
||||
mResultString = ":";
|
||||
mResultString += mModule->TypeToString(resolvedType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BfAutoComplete::CheckResult(BfAstNode* node, const BfTypedValue& typedValue)
|
||||
{
|
||||
if (mResolveType != BfResolveType_GetResultString)
|
||||
return;
|
||||
|
||||
if (!IsAutocompleteNode(node))
|
||||
return;
|
||||
|
||||
if (!typedValue.mValue.IsConst())
|
||||
return;
|
||||
|
||||
if (typedValue.mType->IsPointer())
|
||||
return;
|
||||
if (typedValue.mType->IsObject())
|
||||
return;
|
||||
|
||||
auto constant = mModule->mBfIRBuilder->GetConstant(typedValue.mValue);
|
||||
if (BfIRConstHolder::IsInt(constant->mTypeCode))
|
||||
{
|
||||
mResultString = StrFormat("%lld", constant->mInt64);
|
||||
}
|
||||
else if (BfIRConstHolder::IsFloat(constant->mTypeCode))
|
||||
{
|
||||
mResultString = StrFormat("%f", constant->mDouble);
|
||||
}
|
||||
}
|
||||
|
||||
void BfAutoComplete::CheckLocalDef(BfIdentifierNode* identifierNode, BfLocalVariable* varDecl)
|
||||
{
|
||||
CheckLocalRef(identifierNode, varDecl);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue