TreeRewriter has simplified semantics, and customizable policies with regards to clobbering. Please read the documentation.
Rewriter was discarding the end_pos of the given range for insert_before, and the begin_pos for insert_after. These are meaningful in TreeRewriter.
TreeRewriter's wrap/insert_before/insert_after are multiple by default, while Rewriter would raise clobbering errors if the non '_multi' version was called.
The TreeRewriter policy closest to Rewriter's behavior is:
Coverage decreased (-33.5%) to 65.152% when pulling b0df5ec2315be3973593272c95905ea2e8d881cc on kirylpl:master into 3a38f5fd4843ff5e72d393904064c2e16e59a732 on yujinakayama:master.
Coverage decreased (-0.7%) to 97.907% when pulling a3bb7307054a8f0cb823c0d6ee62208586f62323 on kirylpl:master into 3a38f5fd4843ff5e72d393904064c2e16e59a732 on yujinakayama:master.
Coverage decreased (-0.7%) to 97.907% when pulling a3bb7307054a8f0cb823c0d6ee62208586f62323 on kirylpl:master into 3a38f5fd4843ff5e72d393904064c2e16e59a732 on yujinakayama:master.
Coverage decreased (-0.7%) to 97.907% when pulling a3bb7307054a8f0cb823c0d6ee62208586f62323 on kirylpl:master into 3a38f5fd4843ff5e72d393904064c2e16e59a732 on yujinakayama:master.
http://www.rubydoc.info/github/whitequark/parser/Parser/Source/Rewriter
Rubocop team made related changes in February: https://github.com/bbatsov/rubocop/issues/5579