mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Fixed issues with char8* attribute arguments
This commit is contained in:
parent
327ba62b5a
commit
03c8d72f33
2 changed files with 33 additions and 9 deletions
|
@ -392,6 +392,14 @@ bool BfConstResolver::PrepareMethodArguments(BfAstNode* targetSrc, BfMethodMatch
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ((argValue.mValue.IsFake()) && (!argValue.mType->IsValuelessType()))
|
||||||
|
{
|
||||||
|
if ((mModule->mCurMethodInstance == NULL) || (mModule->mCurMethodInstance->mMethodDef->mMethodType != BfMethodType_Mixin))
|
||||||
|
{
|
||||||
|
mModule->Fail("Expression does not evaluate to a constant value", argExpr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
llvmArgs.push_back(argValue.mValue);
|
llvmArgs.push_back(argValue.mValue);
|
||||||
paramIdx++;
|
paramIdx++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5617,6 +5617,27 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argType->IsPointer())
|
||||||
|
{
|
||||||
|
if (argType->GetUnderlyingType() == GetPrimitiveType(BfTypeCode_Char8))
|
||||||
|
{
|
||||||
|
if (constant->mTypeCode == BfTypeCode_StringId)
|
||||||
|
{
|
||||||
|
int stringId = constant->mInt32;
|
||||||
|
int* orderedIdPtr;
|
||||||
|
if (usedStringIdMap.TryAdd(stringId, NULL, &orderedIdPtr))
|
||||||
|
{
|
||||||
|
*orderedIdPtr = (int)usedStringIdMap.size() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetStringObjectValue(stringId);
|
||||||
|
PUSH_INT8(0xFF); // String
|
||||||
|
PUSH_INT32(*orderedIdPtr);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PUSH_INT8(constant->mTypeCode);
|
PUSH_INT8(constant->mTypeCode);
|
||||||
if ((constant->mTypeCode == BfTypeCode_Int64) ||
|
if ((constant->mTypeCode == BfTypeCode_Int64) ||
|
||||||
(constant->mTypeCode == BfTypeCode_UInt64) ||
|
(constant->mTypeCode == BfTypeCode_UInt64) ||
|
||||||
|
@ -5644,13 +5665,9 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
{
|
{
|
||||||
PUSH_INT8(constant->mInt8);
|
PUSH_INT8(constant->mInt8);
|
||||||
}
|
}
|
||||||
else if (constant->mTypeCode == BfTypeCode_Object)
|
|
||||||
{
|
|
||||||
BFMODULE_FATAL(this, "Unhandled");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BFMODULE_FATAL(this, "Unhandled");
|
Fail(StrFormat("Unhandled attribute constant data in '%s'", TypeToString(type).c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!handled)
|
else if (!handled)
|
||||||
|
@ -12416,7 +12433,6 @@ BfTypedValue BfModule::ReferenceStaticField(BfFieldInstance* fieldInstance)
|
||||||
if (mIsScratchModule)
|
if (mIsScratchModule)
|
||||||
{
|
{
|
||||||
// Just fake it for the extern and unspecialized modules
|
// Just fake it for the extern and unspecialized modules
|
||||||
auto ptrType = CreatePointerType(fieldInstance->GetResolvedType());
|
|
||||||
return BfTypedValue(mBfIRBuilder->GetFakeVal(), fieldInstance->GetResolvedType(), true);
|
return BfTypedValue(mBfIRBuilder->GetFakeVal(), fieldInstance->GetResolvedType(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue