diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 16b1a132..794c2241 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -7116,7 +7116,11 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu if (methodRefType->WantsDataPassedAsSplat(dataIdx)) SplatArgs(lookupVal, irArgs); else + { + if (lookupVal.mType->IsComposite()) + lookupVal = mModule->MakeAddressable(lookupVal, false); irArgs.push_back(lookupVal.mValue); + } } } diff --git a/IDEHelper/Tests/src/FuncRefs.bf b/IDEHelper/Tests/src/FuncRefs.bf index d30e8216..0a5969d0 100644 --- a/IDEHelper/Tests/src/FuncRefs.bf +++ b/IDEHelper/Tests/src/FuncRefs.bf @@ -65,6 +65,34 @@ namespace Tests 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 dlg) where TDlg : delegate void() + { + dlg(); + } + } + [Test] public static void TestBasics() { @@ -90,6 +118,9 @@ namespace Tests int a = 222; TestWrap(() => { a += 100; }); Test.Assert(a == 322); + + TestA ta = scope .(); + ta.Vec = .(33, 44); } struct MethodRefHolder where T : delegate int(int num)