Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: break/continue vs. try-always
On Jun 12, 8:35pm, Peter Stephenson wrote:
}
} This makes a break or continue at the end of a function produce a
} warning. It didn't seem worth a hard error, but presumably a break or
} continue is usually intended to do something so it should be reported if
} it doesn't.
Hrm. That makes it sort of like WARN_CREATE_GLOBAL. I can think of
cases where you want the warning, and cases where you don't ... the
situation that got us to this point is one of latter.
However ...
} +When this option is not set, the effect of tt(break) and tt(continue)
} +commands may propagate outside function scope, affecting loops in
} +calling functions. When this option is not set, a tt(break) or
} +a tt(continue) that is not caught within a function produces a warning.
Typo, extra "not" in the last sentence.
} + opts[LOCALLOOPS] = saveopts[LOCALLOOPS];
} + }
} +
} + if (opts[LOCALLOOPS]) {
} + if (contflag)
} + zwarn("`continue' active at end of function scope");
} + if (breaks)
} + zwarn("`break' active at end of function scope");
} + contflag = breaks = 0;
Since breaks is saved as obreaks on entry to doshfunc, shouldn't this be
breaks = obreaks;
Also, probably need to save/restore contflag and loops? In case the
function is called from a trap handler, for example?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author