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

fix builtin attrib matching

This commit is contained in:
EinBurgbauer 2021-05-26 20:23:12 +02:00
parent 4d0f4b76bc
commit b58c0d4055
7 changed files with 38 additions and 7 deletions

View file

@ -1195,6 +1195,23 @@ bool BfTypeReference::IsTypeDefTypeReference()
return IsA<BfNamedTypeReference>() || IsA<BfDirectStrTypeReference>() || IsA<BfDirectTypeDefReference>();
}
String BfTypeReference::ToCleanAttributeString()
{
// ToString might return something like "System.InlineAttribute", which we want to clean before we test for "Inline"
auto typeRefName = ToString();
if (typeRefName.EndsWith("Attribute"))
{
int attribNameStart = (int)typeRefName.LastIndexOf('.');
if (attribNameStart != -1)
typeRefName.Remove(0, attribNameStart + 1);
if (typeRefName.EndsWith("Attribute"))
typeRefName.RemoveFromEnd(9);
}
return typeRefName;
}
//////////////////////////////////////////////////////////////////////////
BfPropertyMethodDeclaration* BfPropertyDeclaration::GetMethod(const StringImpl& findName)
@ -1262,6 +1279,10 @@ bool BfAttributeDirective::Contains(const StringImpl& findName)
return true;
if (name.EndsWith("Attribute"))
{
int attribNameStart = (int)name.LastIndexOf('.');
if (attribNameStart != -1)
name.Remove(0, attribNameStart + 1);
name.RemoveToEnd(name.length() - 9);
if (findName == name)
return true;