mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +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)
|
if (mCurMethodInstance->mIsUnspecialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mCurTypeInstance->IsTypedPrimitive())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (mBfIRBuilder->mIgnoreWrites)
|
if (mBfIRBuilder->mIgnoreWrites)
|
||||||
return;
|
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());
|
BF_ASSERT(!mCurTypeInstance->IsBoxed());
|
||||||
|
|
||||||
auto compareType = mCurMethodInstance->mParams[0].mResolvedType;
|
auto compareType = mCurMethodInstance->mParams[0].mResolvedType;
|
||||||
|
@ -9754,18 +9761,32 @@ String BfModule::MethodToString(BfMethodInstance* methodInst, BfMethodNameFlags
|
||||||
else if (methodDef->mMethodType == BfMethodType_PropertyGetter)
|
else if (methodDef->mMethodType == BfMethodType_PropertyGetter)
|
||||||
{
|
{
|
||||||
auto propertyDecl = methodDef->GetPropertyDeclaration();
|
auto propertyDecl = methodDef->GetPropertyDeclaration();
|
||||||
if ((propertyDecl != NULL) && (propertyDecl->mNameNode != NULL))
|
if (auto indexerProperty = BfNodeDynCast<BfIndexerDeclaration>(propertyDecl))
|
||||||
propertyDecl->mNameNode->ToString(methodName);
|
{
|
||||||
methodName += " get accessor";
|
methodName += "get indexer";
|
||||||
return methodName;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((propertyDecl != NULL) && (propertyDecl->mNameNode != NULL))
|
||||||
|
propertyDecl->mNameNode->ToString(methodName);
|
||||||
|
methodName += " get accessor";
|
||||||
|
return methodName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (methodDef->mMethodType == BfMethodType_PropertySetter)
|
else if (methodDef->mMethodType == BfMethodType_PropertySetter)
|
||||||
{
|
{
|
||||||
auto propertyDecl = methodDef->GetPropertyDeclaration();
|
auto propertyDecl = methodDef->GetPropertyDeclaration();
|
||||||
if ((propertyDecl != NULL) && (propertyDecl->mNameNode != NULL))
|
if (auto indexerProperty = BfNodeDynCast<BfIndexerDeclaration>(propertyDecl))
|
||||||
propertyDecl->mNameNode->ToString(methodName);
|
{
|
||||||
methodName += " set accessor";
|
methodName += "set indexer";
|
||||||
return methodName;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((propertyDecl != NULL) && (propertyDecl->mNameNode != NULL))
|
||||||
|
propertyDecl->mNameNode->ToString(methodName);
|
||||||
|
methodName += " set accessor";
|
||||||
|
return methodName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
methodName += methodDefName;
|
methodName += methodDefName;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue