mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Allow ref property setter specifier
This commit is contained in:
parent
0d837d23cb
commit
40b0d78d16
6 changed files with 38 additions and 9 deletions
|
@ -1078,12 +1078,19 @@ void BfDefBuilder::Visit(BfPropertyDeclaration* propertyDeclaration)
|
|||
if (BfNodeDynCast<BfTokenNode>(methodDeclaration->mBody) != NULL)
|
||||
methodDef->mIsMutating = true; // Don't require "set mut;", just "set;"
|
||||
|
||||
auto paramDef = new BfParameterDef();
|
||||
auto paramDef = new BfParameterDef();
|
||||
paramDef->mName = "value";
|
||||
if (auto refTypeRef = BfNodeDynCast<BfRefTypeRef>(propertyDeclaration->mTypeRef))
|
||||
paramDef->mTypeRef = refTypeRef->mElementType;
|
||||
paramDef->mTypeRef = propertyDeclaration->mTypeRef;
|
||||
if (auto refTypeRef = BfNodeDynCast<BfRefTypeRef>(propertyDeclaration->mTypeRef))
|
||||
{
|
||||
if (methodDeclaration->mSetRefSpecifier == NULL)
|
||||
paramDef->mTypeRef = refTypeRef->mElementType;
|
||||
}
|
||||
else
|
||||
paramDef->mTypeRef = propertyDeclaration->mTypeRef;
|
||||
{
|
||||
if (methodDeclaration->mSetRefSpecifier != NULL)
|
||||
Fail("Property setter 'ref' can only be used with a 'ref' property type", methodDeclaration->mSetRefSpecifier);
|
||||
}
|
||||
methodDef->mParams.Insert(0, paramDef);
|
||||
propertyDef->mMethods.Add(methodDef);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue