diff --git a/scripts/sipify.py b/scripts/sipify.py index 6f9f943c1a5..02da8618193 100755 --- a/scripts/sipify.py +++ b/scripts/sipify.py @@ -1868,11 +1868,11 @@ while line_idx < line_count: if is_override_or_make_private == PREPEND_CODE_VIRTUAL and not re.match(r'^(\s*)virtual\b(.*)$', rolling_line): - idx = len(output) - line_idx + rolling_line_idx + 2 + idx = rolling_line_idx - line_idx + 1 output[idx] = fix_annotations(re.sub(r'^(\s*?)\b(.*)$', r'\1 virtual \2\n', rolling_line)) elif is_override_or_make_private == PREPEND_CODE_MAKE_PRIVATE: dbg_info("prepending private access") - idx = len(output) - line_idx + rolling_line_idx + 2 + idx = rolling_line_idx - line_idx + 1 private_access = re.sub(r'(protected|public)', 'private', last_access_section_line) output.insert(idx, private_access + "\n") output[idx + 1] = fix_annotations(rolling_line) + "\n"