mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Added support for const string generic args
This commit is contained in:
parent
361be9dc92
commit
a87ccd299d
5 changed files with 63 additions and 5 deletions
|
@ -12338,6 +12338,13 @@ BfIRValue BfModule::CastToValue(BfAstNode* srcNode, BfTypedValue typedVal, BfTyp
|
|||
return typedVal.mValue;
|
||||
}
|
||||
|
||||
if (toConstExprValueType->mValue.mTypeCode == BfTypeCode_StringId)
|
||||
{
|
||||
int stringIdx = GetStringPoolIdx(typedVal.mValue, mBfIRBuilder);
|
||||
if ((stringIdx != -1) && (stringIdx == toConstExprValueType->mValue.mInt32))
|
||||
return typedVal.mValue;
|
||||
}
|
||||
|
||||
if (!ignoreErrors)
|
||||
{
|
||||
String valStr;
|
||||
|
@ -13786,6 +13793,15 @@ void BfModule::VariantToString(StringImpl& str, const BfVariant& variant)
|
|||
str += ".0";
|
||||
}
|
||||
break;
|
||||
case BfTypeCode_StringId:
|
||||
{
|
||||
int stringId = variant.mInt32;
|
||||
auto stringPoolEntry = mContext->mStringObjectIdMap[stringId];
|
||||
str += '"';
|
||||
str += SlashString(stringPoolEntry.mString, false, false, true);
|
||||
str += '"';
|
||||
}
|
||||
break;
|
||||
case BfTypeCode_Let:
|
||||
str += "?";
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue