This teaches functions and macros to use policies recorded at creation
time when they are invoked. It restores the policies as a weak policy
stack entry so that any policies set by a function escape to its caller
as before.
This centralizes construction of the error message for an unclosed
logical block (if, foreach, etc.). We record the line at which each
block is opened so it can be reported in the error message.