mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Support for autoprop initializers
This commit is contained in:
parent
40b0d78d16
commit
041a17cf89
3 changed files with 32 additions and 8 deletions
|
@ -962,12 +962,21 @@ void BfDefBuilder::Visit(BfPropertyDeclaration* propertyDeclaration)
|
|||
fieldDef->mTypeRef = refTypeRef->mElementType;
|
||||
fieldDef->mName = mCurTypeDef->GetAutoPropertyName(propertyDeclaration);
|
||||
fieldDef->mIdx = (int)mCurTypeDef->mFields.size();
|
||||
fieldDef->mInitializer = propertyDeclaration->mInitializer;
|
||||
mCurTypeDef->mFields.push_back(fieldDef);
|
||||
|
||||
mCurTypeDef->mSignatureHash = HashString(fieldDef->mName, mCurTypeDef->mSignatureHash);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (propertyDeclaration->mInitializer != NULL)
|
||||
{
|
||||
if (mCurTypeDef->mTypeCode == BfTypeCode_Interface)
|
||||
Fail("Interface properties cannot have initializers", propertyDeclaration->mInitializer);
|
||||
else
|
||||
Fail("Properties with method bodies cannot have initializers", propertyDeclaration->mInitializer);
|
||||
}
|
||||
|
||||
if (propertyDeclaration->mFieldDtor != NULL)
|
||||
{
|
||||
if (mCurTypeDef->mTypeCode == BfTypeCode_Interface)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue