[flang] Fix bug determining function vs. subroutine
We were setting `expectedProcFlag_` to indicate if a `ProcedureDesignator`
was used in a function or subroutine context. That didn't work if they
were nested, for example: `call f(g())`.
Instead, at the point we know function vs. subroutine (i.e. in the
`CallStmt` and `FunctionReference` nodes), explicitly walk the children,
passing in the flag.
Original-commit: flang-compiler/f18@
8a13283f98c366b74b35bc003f7bc908212a0c6c
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
Tree-same-pre-rewrite: false