[flang] Fix bug handling function prefix type
This showed up in procinterface01. A function can have more than one
PrefixSpec (e.g. `real elemental f()`). We need to ignore that ones
that aren't types.
Also, process the type after the ImplicitPart rather than after the
SpecificationPart. The type of the function result variable could
be accessed between those places.
Original-commit: flang-compiler/f18@
df85eedb925b6f8739d6f6ccd9820ff5d9e4f4c5
Reviewed-on: https://github.com/flang-compiler/f18/pull/305