mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-15 08:31:49 +01:00
[svn r71] Fixed accessing parent function arguments from inside nested delegates.
Some cleanups in VarExp::toElem.
This commit is contained in:
13
test/nested1.d
Normal file
13
test/nested1.d
Normal file
@@ -0,0 +1,13 @@
|
||||
module nested1;
|
||||
|
||||
void func(int i)
|
||||
{
|
||||
(){
|
||||
assert(i == 3);
|
||||
}();
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
func(3);
|
||||
}
|
||||
16
test/nested2.d
Normal file
16
test/nested2.d
Normal file
@@ -0,0 +1,16 @@
|
||||
module nested2;
|
||||
|
||||
void func(ref int i)
|
||||
{
|
||||
delegate {
|
||||
assert(i == 3);
|
||||
i++;
|
||||
}();
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
int i = 3;
|
||||
func(i);
|
||||
assert(i == 4);
|
||||
}
|
||||
Reference in New Issue
Block a user