1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed attempted static lookup in enum underlying type

This commit is contained in:
Brian Fiete 2020-06-13 17:03:31 -07:00
parent 053919d99e
commit f56667ff61
2 changed files with 14 additions and 6 deletions

View file

@ -3322,9 +3322,14 @@ BfTypedValue BfExprEvaluator::LookupIdentifier(BfAstNode* refNode, const StringI
}
}
if (!thisValue.HasType())
thisValue = BfTypedValue(mModule->mCurTypeInstance);
BfTypedValue result = LookupField(identifierNode, thisValue, findName, BfLookupFieldFlag_IsImplicitThis);
if (!thisValue.HasType())
{
thisValue = BfTypedValue(mModule->mCurTypeInstance);
}
BfTypedValue result;
if (thisValue.HasType())
result = LookupField(identifierNode, thisValue, findName, BfLookupFieldFlag_IsImplicitThis);
if (mPropDef != NULL)
{
if (forcedIFaceLookup)
@ -8173,7 +8178,7 @@ void BfExprEvaluator::LookupQualifiedStaticField(BfAstNode* nameNode, BfIdentifi
BfType* type = NULL;
{
SetAndRestoreValue<bool> prevIgnoreErrors(mModule->mIgnoreErrors, true);
type = mModule->ResolveTypeRef(nameLeft, NULL, BfPopulateType_Data, BfResolveTypeRefFlag_AllowRef);
type = mModule->ResolveTypeRef(nameLeft, NULL, BfPopulateType_Declaration, BfResolveTypeRefFlag_AllowRef);
}
if (type != NULL)
{
@ -16672,7 +16677,9 @@ void BfExprEvaluator::DoMemberReference(BfMemberReferenceExpression* memberRefEx
if (!thisValue)
{
if (auto targetIdentifier = BfNodeDynCast<BfIdentifierNode>(exprTarget))
thisValue = BfTypedValue(mModule->ResolveTypeRef(targetIdentifier, NULL));
{
thisValue = BfTypedValue(mModule->ResolveTypeRef(targetIdentifier, NULL, BfPopulateType_Declaration));
}
}
if (!thisValue.HasType())

View file

@ -1612,7 +1612,8 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
for (auto baseTypeRef : typeDef->mBaseTypes)
{
SetAndRestoreValue<BfTypeReference*> prevTypeRef(mContext->mCurTypeState->mCurBaseTypeRef, baseTypeRef);
SetAndRestoreValue<BfTypeReference*> prevTypeRef(mContext->mCurTypeState->mCurBaseTypeRef, baseTypeRef);
SetAndRestoreValue<BfTypeDefineState> prevDefineState(typeInstance->mDefineState, BfTypeDefineState_ResolvingBaseType);
SetAndRestoreValue<bool> prevIgnoreError(mIgnoreErrors, true);
SetAndRestoreValue<bool> prevSkipTypeProtectionChecks(typeInstance->mSkipTypeProtectionChecks, true);