Because IIFEs aren’t adequate for either smart pipelines, we need to create helper functions that allow us to “flatten” statements that contain them, extracting them into preceding constant declarations. This would not only allow us to implement smart pipelines properly, this would also allow us to implement do
expressions away from using IIFEs, which do not work with await
and yield
(see babel/babel#3780).
-
Add a
getChildOfInnermostStatement
method to paths, so that calling the method on a path tox
in…function f () { return Promise.all(g(x)); }
…would return a path pointing to the
Promise.all(g(x))
expression. The same thing would happen if this method is called on paths tog(x)
orPromise.all(g(x))
itself. (Calling it on a path to statements such as thereturn
statement will returnundefined
.)
Similarly, calling this method on a path to x
in…