index: do two passes on the AST, add all local function names to `names` array

This adds support for defining your own custom functions from within
the passed in JS string, and they will be properly "yieldified" so
that everythings works transparently as you would expect.
test: add test case for multiple functions defined in one file