1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-15 06:44:10 +02:00

Fixed methodRef bindResult value type

This commit is contained in:
Brian Fiete 2021-12-28 06:08:06 -05:00
parent 98eb8f5840
commit fd8e2dd232
3 changed files with 27 additions and 2 deletions

View file

@ -11957,7 +11957,7 @@ void BfExprEvaluator::Visit(BfDelegateBindExpression* delegateBindExpr)
if (bindResult.mTarget.IsSplat()) if (bindResult.mTarget.IsSplat())
target = mModule->AggregateSplat(bindResult.mTarget, &bindResult.mIRArgs[0]); target = mModule->AggregateSplat(bindResult.mTarget, &bindResult.mIRArgs[0]);
else else
target = mModule->LoadValue(bindResult.mTarget); target = bindResult.mTarget;
mModule->mBfIRBuilder->CreateStore(target.mValue, elemPtr); mModule->mBfIRBuilder->CreateStore(target.mValue, elemPtr);

View file

@ -2631,6 +2631,8 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
if (methodInstance != NULL) if (methodInstance != NULL)
name += BfTypeUtils::HashEncode64(methodInstance->mIdHash).c_str(); name += BfTypeUtils::HashEncode64(methodInstance->mIdHash).c_str();
BF_ASSERT(methodInstance != NULL);
if ((wantDIData) && (methodInstance != NULL)) if ((wantDIData) && (methodInstance != NULL))
{ {
auto typeDeclaration = methodInstance->GetOwner()->mTypeDef->mTypeDeclaration; auto typeDeclaration = methodInstance->GetOwner()->mTypeDef->mTypeDeclaration;

View file

@ -69,9 +69,21 @@ namespace Tests
{ {
} }
class Invoker
{
public int mA = 111;
public void Invoke()
{
mA += 222;
}
}
class TestA class TestA
{ {
Vector2 mVec = .(11, 22); Vector2 mVec = .(11, 22);
Event<Action> mEvt ~ _.Dispose();
Action mAct;
public Vector2 Vec public Vector2 Vec
{ {
@ -84,6 +96,17 @@ namespace Tests
Test.Assert(value.x == 33); Test.Assert(value.x == 33);
Test.Assert(value.y == 44); Test.Assert(value.y == 44);
}); });
Invoker invoker = scope .();
mEvt.Add(new => invoker);
DoIt(=> mEvt);
Test.Assert(invoker.mA == 333);
DoIt(=> invoker);
Test.Assert(invoker.mA == 555);
mAct = scope => invoker;
mAct();
Test.Assert(invoker.mA == 777);
DoIt(=> mAct);
Test.Assert(invoker.mA == 999);
} }
} }