www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Mixed closures and class.outer references

Hi,

Can someone tell me what is supposed to happen in Outer.foo.Inner.bar?
 And how it should look in debug?

---
class Outer
{
    int x = 42;
    void foo()
    {
        int y = 43;
        class Inner
        {
            void bar()
            {
                assert(x == 42);
                assert(y == 43);
            }
        }
        Inner b = new Inner();
        b.bar();
    }
}
---

What I'm currently seeing is:

Function: Inner.bar()
Params: (this=...)
typeof(this) == Inner
typeof(this.this) == Outer

No sign of the closure in Outer.foo, so how is 'y' even accessible?
Apr 12 2015