mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Fixed a splat-to-addr bug with methodRef captures
This commit is contained in:
parent
87ab0ad169
commit
e81c0d6dfa
2 changed files with 35 additions and 0 deletions
|
@ -7116,7 +7116,11 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
|
||||||
if (methodRefType->WantsDataPassedAsSplat(dataIdx))
|
if (methodRefType->WantsDataPassedAsSplat(dataIdx))
|
||||||
SplatArgs(lookupVal, irArgs);
|
SplatArgs(lookupVal, irArgs);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (lookupVal.mType->IsComposite())
|
||||||
|
lookupVal = mModule->MakeAddressable(lookupVal, false);
|
||||||
irArgs.push_back(lookupVal.mValue);
|
irArgs.push_back(lookupVal.mValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,34 @@ namespace Tests
|
||||||
ac();
|
ac();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct Vector2 : this(float x, float y)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
class TestA
|
||||||
|
{
|
||||||
|
Vector2 mVec = .(11, 22);
|
||||||
|
|
||||||
|
public Vector2 Vec
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
DoIt(() =>
|
||||||
|
{
|
||||||
|
Test.Assert(mVec.x == 11);
|
||||||
|
Test.Assert(mVec.y == 22);
|
||||||
|
Test.Assert(value.x == 33);
|
||||||
|
Test.Assert(value.y == 44);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoIt<TDlg>(TDlg dlg) where TDlg : delegate void()
|
||||||
|
{
|
||||||
|
dlg();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public static void TestBasics()
|
public static void TestBasics()
|
||||||
{
|
{
|
||||||
|
@ -90,6 +118,9 @@ namespace Tests
|
||||||
int a = 222;
|
int a = 222;
|
||||||
TestWrap(() => { a += 100; });
|
TestWrap(() => { a += 100; });
|
||||||
Test.Assert(a == 322);
|
Test.Assert(a == 322);
|
||||||
|
|
||||||
|
TestA ta = scope .();
|
||||||
|
ta.Vec = .(33, 44);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MethodRefHolder<T> where T : delegate int(int num)
|
struct MethodRefHolder<T> where T : delegate int(int num)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue