This fixes a problem with converting the ubound call in the example
below back to Fortran (in this case, for writing to the .mod file).
One of the ActualArguments encountered in ProcedureRef::AsFortran is
a `std::nullopt`, so we need to handle that case.
```
module m
real :: x(10)
real :: y(ubound(x, dim=1))
end module
```
Original-commit: flang-compiler/f18@
c5ace6b8241cd1ef86f0649941bf38386d99bdc4
Reviewed-on: https://github.com/flang-compiler/f18/pull/240
proc_.AsFortran(o);
char separator{'('};
for (const auto &arg : arguments_) {
- arg->AsFortran(o << separator);
- separator = ',';
+ if (arg.has_value()) {
+ arg->AsFortran(o << separator);
+ separator = ',';
+ }
}
if (separator == '(') {
o << '(';