mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fixed typed primitive Equals method generation
This commit is contained in:
parent
206b508d38
commit
e92eed776c
1 changed files with 33 additions and 12 deletions
|
@ -4150,13 +4150,20 @@ void BfModule::CreateValueTypeEqualsMethod(bool strictEquals)
|
|||
{
|
||||
if (mCurMethodInstance->mIsUnspecialized)
|
||||
return;
|
||||
|
||||
if (mCurTypeInstance->IsTypedPrimitive())
|
||||
return;
|
||||
|
||||
|
||||
if (mBfIRBuilder->mIgnoreWrites)
|
||||
return;
|
||||
|
||||
if (mCurTypeInstance->IsTypedPrimitive())
|
||||
{
|
||||
BfExprEvaluator exprEvaluator(this);
|
||||
BfTypedValue leftTypedVal = LoadValue(exprEvaluator.LoadLocal(mCurMethodState->mLocals[0]));
|
||||
BfTypedValue rightTypedVal = LoadValue(exprEvaluator.LoadLocal(mCurMethodState->mLocals[1]));
|
||||
auto cmpResult = mBfIRBuilder->CreateCmpEQ(leftTypedVal.mValue, rightTypedVal.mValue);
|
||||
mBfIRBuilder->CreateRet(cmpResult);
|
||||
return;
|
||||
}
|
||||
|
||||
BF_ASSERT(!mCurTypeInstance->IsBoxed());
|
||||
|
||||
auto compareType = mCurMethodInstance->mParams[0].mResolvedType;
|
||||
|
@ -9754,18 +9761,32 @@ String BfModule::MethodToString(BfMethodInstance* methodInst, BfMethodNameFlags
|
|||
else if (methodDef->mMethodType == BfMethodType_PropertyGetter)
|
||||
{
|
||||
auto propertyDecl = methodDef->GetPropertyDeclaration();
|
||||
if ((propertyDecl != NULL) && (propertyDecl->mNameNode != NULL))
|
||||
propertyDecl->mNameNode->ToString(methodName);
|
||||
methodName += " get accessor";
|
||||
return methodName;
|
||||
if (auto indexerProperty = BfNodeDynCast<BfIndexerDeclaration>(propertyDecl))
|
||||
{
|
||||
methodName += "get indexer";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((propertyDecl != NULL) && (propertyDecl->mNameNode != NULL))
|
||||
propertyDecl->mNameNode->ToString(methodName);
|
||||
methodName += " get accessor";
|
||||
return methodName;
|
||||
}
|
||||
}
|
||||
else if (methodDef->mMethodType == BfMethodType_PropertySetter)
|
||||
{
|
||||
auto propertyDecl = methodDef->GetPropertyDeclaration();
|
||||
if ((propertyDecl != NULL) && (propertyDecl->mNameNode != NULL))
|
||||
propertyDecl->mNameNode->ToString(methodName);
|
||||
methodName += " set accessor";
|
||||
return methodName;
|
||||
if (auto indexerProperty = BfNodeDynCast<BfIndexerDeclaration>(propertyDecl))
|
||||
{
|
||||
methodName += "set indexer";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((propertyDecl != NULL) && (propertyDecl->mNameNode != NULL))
|
||||
propertyDecl->mNameNode->ToString(methodName);
|
||||
methodName += " set accessor";
|
||||
return methodName;
|
||||
}
|
||||
}
|
||||
else
|
||||
methodName += methodDefName;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue