MCPcopy Create free account
hub / github.com/beefytech/Beef / ValidateCustomAttributes

Method ValidateCustomAttributes

IDEHelper/Compiler/BfModule.cpp:12543–12564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12541}
12542
12543void BfModule::ValidateCustomAttributes(BfCustomAttributes* customAttributes, BfAttributeTargets attrTarget, bool force)
12544{
12545 if (attrTarget == BfAttributeTargets_SkipValidate)
12546 return;
12547
12548 for (auto& customAttribute : customAttributes->mAttributes)
12549 {
12550 if (!customAttribute.mAwaitingValidation)
12551 continue;
12552
12553 if ((customAttribute.mType->mAttributeData->mAttributeTargets & attrTarget) == 0)
12554 {
12555 if ((customAttribute.mIsMultiUse) && (!force))
12556 continue;
12557
12558 Fail(StrFormat("Attribute '%s' is not valid on this declaration type. It is only valid on %s.",
12559 customAttribute.GetRefNode()->ToString().c_str(), GetAttributesTargetListString(customAttribute.mType->mAttributeData->mAttributeTargets).c_str()), customAttribute.mRef->mAttributeTypeRef); // CS0592
12560 }
12561
12562 customAttribute.mAwaitingValidation = false;
12563 }
12564}
12565
12566void BfModule::GetCustomAttributes(BfCustomAttributes* customAttributes, BfAttributeDirective* attributesDirective, BfAttributeTargets attrTarget, BfGetCustomAttributesFlags flags, BfCaptureInfo* captureInfo)
12567{

Callers 1

DoMemberReferenceMethod · 0.80

Calls 5

FailFunction · 0.85
c_strMethod · 0.45
ToStringMethod · 0.45
GetRefNodeMethod · 0.45

Tested by

no test coverage detected