mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Added field dtor support for auto-properties
This commit is contained in:
parent
90a51834bc
commit
f831d75de2
2 changed files with 16 additions and 0 deletions
|
@ -963,6 +963,13 @@ void BfDefBuilder::Visit(BfPropertyDeclaration* propertyDeclaration)
|
||||||
|
|
||||||
mCurTypeDef->mSignatureHash = HashString(fieldDef->mName, mCurTypeDef->mSignatureHash);
|
mCurTypeDef->mSignatureHash = HashString(fieldDef->mName, mCurTypeDef->mSignatureHash);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mCurTypeDef->mTypeCode == BfTypeCode_Interface)
|
||||||
|
Fail("Interface properties cannot have field destructors", propertyDeclaration->mFieldDtor);
|
||||||
|
else if (propertyDeclaration->mFieldDtor != NULL)
|
||||||
|
Fail("Properties with method bodies cannot have field destructors", propertyDeclaration->mFieldDtor);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto methodDeclaration : propertyDeclaration->mMethods)
|
for (auto methodDeclaration : propertyDeclaration->mMethods)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6875,6 +6875,15 @@ BfAstNode* BfReducer::ReadTypeMember(BfAstNode* node, int depth, BfAstNode* defe
|
||||||
{
|
{
|
||||||
MEMBER_SET(propertyDeclaration, mDefinitionBlock, block);
|
MEMBER_SET(propertyDeclaration, mDefinitionBlock, block);
|
||||||
ReadPropertyBlock(propertyDeclaration, block);
|
ReadPropertyBlock(propertyDeclaration, block);
|
||||||
|
|
||||||
|
if (auto tokenNode = BfNodeDynCast<BfTokenNode>(mVisitorPos.GetNext()))
|
||||||
|
{
|
||||||
|
if (tokenNode->mToken == BfToken_Tilde)
|
||||||
|
{
|
||||||
|
auto fieldDtor = CreateFieldDtorDeclaration(tokenNode);
|
||||||
|
MEMBER_SET(propertyDeclaration, mFieldDtor, fieldDtor);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (isExprBodyProp)
|
else if (isExprBodyProp)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue