Do not rewrite lambdas inside coroutine functions
commit6fc0f69ea8dff89d4fdcccbcd4c911741f5a7517
authorMichael Tingley <tingley@fb.com>
Wed, 21 Jun 2017 00:25:41 +0000 (20 17:25 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 21 Jun 2017 00:27:39 +0000 (20 17:27 -0700)
treef5dca0c570bde38918cfd84edaebb7e186505874
parent2cd4d870e98b5c27de769c2ca5870512ed79b1b9
Do not rewrite lambdas inside coroutine functions

Summary:
Prior to this diff, a lambda contained inside a coroutine function would get rewritten.

```
($x) ==> {
  return $x + 1;
};
```

Would erroneously become

```
($x) ==> {
  $this->nextLabel = -1;
  return new ActualCoroutineResult($x + 1);
};
```

Obviously not good. This diff is a (robust & inefficient) workaround to fix this. However, ultimately, we should add the "don't rewrite me, or anything beneath me" functionality to the `full_fidelity_rewriter`.

Reviewed By: ericlippert

Differential Revision: D5219186

fbshipit-source-id: 58c760efe1d2bf01c8c8b2adbed59404a47f1538
hphp/hack/src/parser/coroutine/coroutine_state_machine_generator.ml