mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-11 04:52:21 +02:00
Fixed erroneous autoprop optimization when getter or setter has a body
This commit is contained in:
parent
78c39c5f87
commit
91897f8cb3
1 changed files with 34 additions and 23 deletions
|
@ -4871,14 +4871,24 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
|||
{
|
||||
if ((curCheckType->mTypeDef->HasAutoProperty(propertyDeclaration)) && (propertyDeclaration->mVirtualSpecifier == NULL))
|
||||
{
|
||||
bool hasSetter = GetPropertyMethodDef(mPropDef, BfMethodType_PropertySetter, BfCheckedKind_NotSet, mPropTarget) != NULL;
|
||||
BfMethodDef* getter = GetPropertyMethodDef(mPropDef, BfMethodType_PropertySetter, BfCheckedKind_NotSet, mPropTarget);
|
||||
BfMethodDef* setter = GetPropertyMethodDef(mPropDef, BfMethodType_PropertySetter, BfCheckedKind_NotSet, mPropTarget);
|
||||
|
||||
bool optAllowed = true;
|
||||
if ((getter != NULL) && (getter->mBody != NULL))
|
||||
optAllowed = false;
|
||||
if ((setter != NULL) && (setter->mBody != NULL))
|
||||
optAllowed = false;
|
||||
|
||||
if (optAllowed)
|
||||
{
|
||||
auto autoFieldName = curCheckType->mTypeDef->GetAutoPropertyName(propertyDeclaration);
|
||||
auto result = LookupField(targetSrc, target, autoFieldName, (BfLookupFieldFlags)(BfLookupFieldFlag_IgnoreProtection | BfLookupFieldFlag_IsImplicitThis));
|
||||
if (result)
|
||||
{
|
||||
bool needsCopy = true;
|
||||
|
||||
if (!hasSetter)
|
||||
if (setter == NULL)
|
||||
{
|
||||
if (((mModule->mCurMethodInstance->mMethodDef->mMethodType == BfMethodType_Ctor)) &&
|
||||
(startCheckType == mModule->mCurTypeInstance))
|
||||
|
@ -4903,6 +4913,7 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetAndRestoreValue<BfTypedValue> prevResult(mResult, target);
|
||||
CheckResultForReading(mResult);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue