From 3b11491ceaa75f7513e08d70ecf5d1bb8d5b9308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?fn=20=E2=8C=83=20=E2=8C=A5?= <70830482+FnControlOption@users.noreply.github.com> Date: Tue, 26 Oct 2021 21:09:32 -0700 Subject: [PATCH] Add `insert_*` overloads that accept both location and end_location --- src/ameba/source/corrector.cr | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ameba/source/corrector.cr b/src/ameba/source/corrector.cr index fbb50f8a..f4adf1da 100644 --- a/src/ameba/source/corrector.cr +++ b/src/ameba/source/corrector.cr @@ -21,6 +21,14 @@ class Ameba::Source @rewriter.remove(loc_to_pos(location), loc_to_pos(end_location) + 1) end + def insert_before(location, end_location, content) + @rewriter.insert_before(loc_to_pos(location), loc_to_pos(end_location) + 1, content) + end + + def insert_after(location, end_location, content) + @rewriter.insert_after(loc_to_pos(location), loc_to_pos(end_location) + 1, content) + end + def insert_before(location, content) @rewriter.insert_before(loc_to_pos(location), content) end