Propagate static flags into with blocks

Need this to properly specialise functions generated using 'with',
otherwise the with blocks get left alone.