| 8402 | } |
| 8403 | |
| 8404 | void BfModule::ResolveGenericParamConstraints(BfGenericParamInstance* genericParamInstance, bool isUnspecialized, Array<BfTypeReference*>* deferredResolveTypes) |
| 8405 | { |
| 8406 | BfGenericParamDef* genericParamDef = genericParamInstance->GetGenericParamDef(); |
| 8407 | BfExternalConstraintDef* externConstraintDef = genericParamInstance->GetExternConstraintDef(); |
| 8408 | BfConstraintDef* constraintDef = genericParamInstance->GetConstraintDef(); |
| 8409 | |
| 8410 | BfType* startingTypeConstraint = genericParamInstance->mTypeConstraint; |
| 8411 | |
| 8412 | BfAutoComplete* bfAutocomplete = NULL; |
| 8413 | if ((mCompiler->mResolvePassData != NULL) && (isUnspecialized)) |
| 8414 | bfAutocomplete = mCompiler->mResolvePassData->mAutoComplete; |
| 8415 | |
| 8416 | if ((bfAutocomplete != NULL) && (genericParamDef != NULL)) |
| 8417 | { |
| 8418 | for (int nameIdx = 0; nameIdx < (int)genericParamDef->mNameNodes.size(); nameIdx++) |
| 8419 | { |
| 8420 | auto nameNode = genericParamDef->mNameNodes[nameIdx]; |
| 8421 | if (bfAutocomplete->IsAutocompleteNode(nameNode)) |
| 8422 | { |
| 8423 | String filter = nameNode->ToString(); |
| 8424 | bfAutocomplete->mInsertStartIdx = nameNode->GetSrcStart(); |
| 8425 | bfAutocomplete->mInsertEndIdx = nameNode->GetSrcEnd(); |
| 8426 | |
| 8427 | if (nameIdx != 0) |
| 8428 | { |
| 8429 | bfAutocomplete->AddEntry(AutoCompleteEntry("generic", nameNode->ToString().c_str()), filter); |
| 8430 | } |
| 8431 | } |
| 8432 | } |
| 8433 | } |
| 8434 | |
| 8435 | for (auto constraint : constraintDef->mConstraints) |
| 8436 | { |
| 8437 | if (auto opConstraint = BfNodeDynCast<BfGenericOperatorConstraint>(constraint)) |
| 8438 | { |
| 8439 | BfGenericOperatorConstraintInstance opConstraintInstance; |
| 8440 | |
| 8441 | if (opConstraint->mLeftType != NULL) |
| 8442 | { |
| 8443 | if (bfAutocomplete != NULL) |
| 8444 | bfAutocomplete->CheckTypeRef(opConstraint->mLeftType, false); |
| 8445 | opConstraintInstance.mLeftType = ResolveTypeRef(opConstraint->mLeftType, BfPopulateType_Interfaces_All); |
| 8446 | if (opConstraintInstance.mLeftType == NULL) |
| 8447 | continue; |
| 8448 | } |
| 8449 | |
| 8450 | if (opConstraint->mRightType == NULL) |
| 8451 | { |
| 8452 | // We had a failure in parsing |
| 8453 | continue; |
| 8454 | } |
| 8455 | |
| 8456 | if (opConstraint->mRightType != NULL) |
| 8457 | { |
| 8458 | if (bfAutocomplete != NULL) |
| 8459 | bfAutocomplete->CheckTypeRef(opConstraint->mRightType, false); |
| 8460 | opConstraintInstance.mRightType = ResolveTypeRef(opConstraint->mRightType, BfPopulateType_Interfaces_All); |
| 8461 | if (opConstraintInstance.mRightType == NULL) |
no test coverage detected