Base status -b off the parser execution stack

Instead of globally marking the state as "in block" when evaluating
blocks/functions, update the "in block" status when pushing/popping
blocks on the parser stack.

Fixes #1729.

On a side note, `status -b` is actually pretty useless, because it
always returns 0 inside of a function (even without this patch).
This commit is contained in:
Kevin Ballard
2014-09-30 20:58:45 -07:00
parent 489fb7ec3f
commit 3616dd5889
4 changed files with 30 additions and 5 deletions

View File

@@ -1,9 +1,17 @@
# vim: set filetype=fish:
status -b
or echo 'top level'
begin
status -b
end
and echo 'block'
# Issue #1728
# Bad file redirection on a block causes `status --is-block` to return 0 forever.
begin; end >/ # / is a directory, it can't be opened for writing
status -b
and echo 'block'
and echo 'unexpected block'
true

View File

@@ -0,0 +1,2 @@
top level
block