| 5298 | } |
| 5299 | |
| 5300 | BfTypedValue BfExprEvaluator::LoadField(BfAstNode* targetSrc, BfTypedValue target, BfTypeInstance* typeInstance, BfFieldDef* fieldDef, BfLookupFieldFlags flags) |
| 5301 | { |
| 5302 | if (fieldDef->mIsProperty) |
| 5303 | { |
| 5304 | BfPropertyDef* propDef = (BfPropertyDef*)fieldDef; |
| 5305 | return LoadProperty(targetSrc, target, typeInstance, propDef, flags, BfCheckedKind_NotSet, false); |
| 5306 | } |
| 5307 | |
| 5308 | bool isFailurePass = (flags & BfLookupFieldFlag_IsFailurePass) != 0; |
| 5309 | |
| 5310 | auto fieldInstance = &typeInstance->mFieldInstances[fieldDef->mIdx]; |
| 5311 | |
| 5312 | bool isResolvingFields = typeInstance->mResolvingConstField || typeInstance->mResolvingVarField; |
| 5313 | |
| 5314 | if (fieldDef->mIsVolatile) |
| 5315 | mIsVolatileReference = true; |
| 5316 | |
| 5317 | if (fieldInstance->mCustomAttributes != NULL) |
| 5318 | mModule->CheckErrorAttributes(fieldInstance->mOwner, NULL, fieldInstance, fieldInstance->mCustomAttributes, targetSrc); |
| 5319 | |
| 5320 | if (isFailurePass) |
| 5321 | { |
| 5322 | if (mModule->GetCeDbgState() == NULL) |
| 5323 | mModule->Fail(StrFormat("'%s.%s' is inaccessible due to its protection level", mModule->TypeToString(typeInstance).c_str(), fieldDef->mName.c_str()), targetSrc); |
| 5324 | } |
| 5325 | |
| 5326 | auto resolvePassData = mModule->mCompiler->mResolvePassData; |
| 5327 | if ((resolvePassData != NULL) && (resolvePassData->mGetSymbolReferenceKind == BfGetSymbolReferenceKind_Field) && ((flags & BfLookupFieldFlag_IsAnonymous) == 0)) |
| 5328 | { |
| 5329 | resolvePassData->HandleFieldReference(targetSrc, typeInstance->mTypeDef, fieldDef); |
| 5330 | } |
| 5331 | |
| 5332 | if ((!typeInstance->mTypeFailed) && (!isResolvingFields) && (typeInstance->IsIncomplete())) |
| 5333 | { |
| 5334 | if ((fieldInstance->mResolvedType == NULL) || |
| 5335 | (!fieldDef->mIsStatic)) |
| 5336 | { |
| 5337 | mModule->PopulateType(typeInstance, BfPopulateType_Data); |
| 5338 | |
| 5339 | // Update fieldInstance pointer as it may have moved |
| 5340 | fieldInstance = &typeInstance->mFieldInstances[fieldDef->mIdx]; |
| 5341 | } |
| 5342 | } |
| 5343 | |
| 5344 | if (fieldInstance->mResolvedType == NULL) |
| 5345 | { |
| 5346 | if (mModule->mCompiler->EnsureCeUnpaused(typeInstance)) |
| 5347 | { |
| 5348 | BF_ASSERT((typeInstance->mTypeFailed) || (isResolvingFields)); |
| 5349 | } |
| 5350 | return BfTypedValue(); |
| 5351 | } |
| 5352 | |
| 5353 | if (fieldInstance->mFieldIdx == -1) |
| 5354 | { |
| 5355 | mModule->AssertErrorState(); |
| 5356 | return BfTypedValue(); |
| 5357 | } |
nothing calls this directly
no test coverage detected