Circular function expressions

Fixes #445 and #583.

Function expression bodies are now checked in a separate phase after all statements in the enclosing body to ensure constructs like the following are correctly typed:
```typescript
var foo = function () {
    var s = foo();
    return "hello";
}
```
Previously we'd perform a full type check of the body of the function expression whilst in the process determining the type of `foo` which would cause `foo` to be given type `any` because of the recursive reference. With this change, `foo` is now correctly typed as `() => string`.
The bodies of function expressions in parameter initializers are now checked at a later phase and therefore don't appear to come before parameters that are declared to the right. This actually better matches reality as function expressions in initializers are executed later.