mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Added System.Compiler compile-time values
This commit is contained in:
parent
24aaa22f7a
commit
25f44ae133
11 changed files with 294 additions and 75 deletions
|
@ -2243,7 +2243,36 @@ void BfMangler::Mangle(StringImpl& outStr, MangleKind mangleKind, BfMethodInstan
|
|||
}
|
||||
|
||||
void BfMangler::Mangle(StringImpl& outStr, MangleKind mangleKind, BfFieldInstance* fieldInstance)
|
||||
{
|
||||
{
|
||||
if (fieldInstance->mCustomAttributes != NULL)
|
||||
{
|
||||
auto module = fieldInstance->mOwner->mModule;
|
||||
auto linkNameAttr = fieldInstance->mCustomAttributes->Get(module->mCompiler->mLinkNameAttributeTypeDef);
|
||||
if (linkNameAttr != NULL)
|
||||
{
|
||||
if (linkNameAttr->mCtorArgs.size() == 1)
|
||||
{
|
||||
if (module->TryGetConstString(fieldInstance->mOwner->mConstHolder, linkNameAttr->mCtorArgs[0], outStr))
|
||||
if (!outStr.IsWhitespace())
|
||||
return;
|
||||
|
||||
auto constant = fieldInstance->mOwner->mConstHolder->GetConstant(linkNameAttr->mCtorArgs[0]);
|
||||
if (constant != NULL)
|
||||
{
|
||||
if (constant->mInt32 == 1) // C
|
||||
{
|
||||
outStr += fieldInstance->GetFieldDef()->mName;
|
||||
return;
|
||||
}
|
||||
else if (constant->mInt32 == 2) // CPP
|
||||
{
|
||||
//mangleContext.mCPPMangle = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mangleKind == BfMangler::MangleKind_GNU)
|
||||
outStr += BfGNUMangler::MangleStaticFieldName(fieldInstance->mOwner, fieldInstance->GetFieldDef()->mName);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue