Add test for explicitly capturing "this"
This commit is contained in:
26
unittests/explicit_this_capture.chai
Normal file
26
unittests/explicit_this_capture.chai
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
class Test
|
||||||
|
{
|
||||||
|
def Test()
|
||||||
|
{}
|
||||||
|
|
||||||
|
def a(Function f)
|
||||||
|
{
|
||||||
|
f("test");
|
||||||
|
// f();
|
||||||
|
}
|
||||||
|
|
||||||
|
def b()
|
||||||
|
{
|
||||||
|
var l = fun [this](x) { this.thing(); }
|
||||||
|
this.a(l)
|
||||||
|
}
|
||||||
|
|
||||||
|
def thing()
|
||||||
|
{
|
||||||
|
print("hello world");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var t = Test()
|
||||||
|
t.b()
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user