I think you can simplify this by putting the invariant first:
invariant(_enabled.test(kW)...)
return _w;