April 13, 2015 Re: Mixed closures and class.outer references | ||||
|---|---|---|---|---|
| ||||
On 12 April 2015 at 21:36, Iain Buclaw <ibuclaw@gdcproject.org> wrote: > 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? I've raised a bug: https://issues.dlang.org/show_bug.cgi?id=14442 | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply