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

Beefy::String changes, lambda hotswap fixes

Changed some string internals related to StringViewsma
Added an "incompatible capture" error for lambdas when the captures change
This commit is contained in:
Brian Fiete 2019-09-03 11:17:13 -07:00
parent 767a3fafd9
commit 2f01cc14dd
25 changed files with 544 additions and 180 deletions

View file

@ -0,0 +1,28 @@
# This tests modifying anonymous lambdas, including changing captured data (both legally and illegally)
ShowFile("src/HotSwap_Lambdas01.bf")
GotoText("//Test_Start")
ToggleBreakpoint()
RunWithCompiling()
StepOver()
StepOver()
StepOver()
StepOver()
AssertEvalEquals("val0", "200")
AssertEvalEquals("val1", "423")
AssertEvalEquals("val2", "757")
ToggleCommentAt("Dlg0_0")
ToggleCommentAt("Dlg1_0")
ToggleCommentAt("Dlg2_0")
Compile()
SetExpectError("incompatible captures")
StepOver()
ExpectError()
StepOut()
StepOver()
StepOver()
AssertEvalEquals("val0", "200")
AssertEvalEquals("val1", "300")
AssertEvalEquals("val2", "523")

View file

@ -0,0 +1,62 @@
#pragma warning disable 168
namespace IDETest
{
class HotSwap_Lambdas01
{
class ClassA
{
public delegate int() mDlg0 ~ delete _;
public delegate int() mDlg1 ~ delete _;
public delegate int() mDlg2 ~ delete _;
int mA = 123;
public this()
{
int val = 234;
mDlg0 = new () =>
{
int ret = 200;
/*Dlg0_0
ret += mA;
*/
return ret;
};
mDlg1 = new () =>
{
int ret = 300;
//*Dlg1_0
ret += mA;
/*@*/
return ret;
};
mDlg2 = new () =>
{
int ret = 400;
//*Dlg2_0
ret += val;
/*@*/
ret += mA;
return ret;
};
}
}
public static void Test()
{
//Test_Start
ClassA ca = scope .();
int val0 = ca.mDlg0();
int val1 = ca.mDlg1();
int val2 = ca.mDlg2();
val0 = ca.mDlg0();
val1 = ca.mDlg1();
val2 = ca.mDlg2();
}
}
}

View file

@ -14,6 +14,7 @@ namespace IDETest
HotSwap_Data.Test();
HotSwap_GetUnusued.Test();
HotSwap_Interfaces2.Test();
HotSwap_Lambdas01.Test();
HotSwap_LocateSym01.Test();
HotSwap_Reflection.Test();
HotSwap_TLS.Test();