mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 12:02:21 +02:00
Fixed multiple calls to base ctor in extension with bodyless ctor
This commit is contained in:
parent
78ae79b802
commit
c91e8e0fb4
2 changed files with 36 additions and 2 deletions
|
@ -16160,7 +16160,7 @@ void BfModule::EmitCtorBody(bool& skipBody)
|
||||||
auto targetToken = BfNodeDynCast<BfTokenNode>(ctorInvocation->mTarget);
|
auto targetToken = BfNodeDynCast<BfTokenNode>(ctorInvocation->mTarget);
|
||||||
targetType = (targetToken->GetToken() == BfToken_This) ? mCurTypeInstance : mCurTypeInstance->mBaseType;
|
targetType = (targetToken->GetToken() == BfToken_This) ? mCurTypeInstance : mCurTypeInstance->mBaseType;
|
||||||
}
|
}
|
||||||
else if ((mCurTypeInstance->mBaseType != NULL) && (!mCurTypeInstance->IsUnspecializedType()))
|
else if ((mCurTypeInstance->mBaseType != NULL) && (!mCurTypeInstance->IsUnspecializedType()) && (methodDef->mMethodType != BfMethodType_CtorNoBody))
|
||||||
{
|
{
|
||||||
auto baseType = mCurTypeInstance->mBaseType;
|
auto baseType = mCurTypeInstance->mBaseType;
|
||||||
if ((!mCurTypeInstance->IsTypedPrimitive()) &&
|
if ((!mCurTypeInstance->IsTypedPrimitive()) &&
|
||||||
|
|
|
@ -116,6 +116,36 @@ namespace Tests
|
||||||
public override void MethodA() { }
|
public override void MethodA() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ClassD
|
||||||
|
{
|
||||||
|
public int mD = MethodD0() ~ MethodD0();
|
||||||
|
|
||||||
|
public int MethodD0()
|
||||||
|
{
|
||||||
|
return mD + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MethodD1()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassE : ClassD
|
||||||
|
{
|
||||||
|
public int mE = MethodE0();
|
||||||
|
|
||||||
|
public int MethodE0()
|
||||||
|
{
|
||||||
|
return mE + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ClassE
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
class TClassA<T> where T : IDisposable
|
class TClassA<T> where T : IDisposable
|
||||||
{
|
{
|
||||||
public int32 mA = 10;
|
public int32 mA = 10;
|
||||||
|
@ -192,6 +222,10 @@ namespace Tests
|
||||||
|
|
||||||
ClassC cc = scope .();
|
ClassC cc = scope .();
|
||||||
cc.MethodB();
|
cc.MethodB();
|
||||||
|
|
||||||
|
ClassE ce = scope .();
|
||||||
|
Test.Assert(ce.mD == 1);
|
||||||
|
Test.Assert(ce.mE == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue