Analyze closure bodies in the class context they actually run in
Closure bodies run in the context of the class that allocated
them. Previously, we were giving up on private and static property
inference in any class that allocated closures because we couldn't see
the closure bodies as part of class-at-a-time analysis (and couldn't
take their effects into account). This diff hooks that up, and also
adds links between inner and outer generators (which should probably
be helpful for other things later).
After this diff, we still give up on classes containing closures that
contain yield. Classes with async function closures are working in a
slightly strange way: we essentially only analyze the "eager" version
for its effects on $this and self. I think this is fine for now, but
it's relying on a bunch of undocumented invariants (essentially it's
relying on the fact that the two function bodies "do the same thing"):
@jano is planning to combine the bytecode bodies for async functions so
we probably don't need to worry too about documenting all that in the
spec until the implementation stabilizes more.
Reviewed By: @bertmaher
Differential Revision:
D1143994