Skip to content

fix: 🐛 fixed super fixing #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions addons/mod_loader/internal/mod_hook_preprocessor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ static func get_function_parameters(method_name: String, text: String, is_static
if not is_top_level_func(text, result.get_start(), is_static):
return get_function_parameters(method_name, text, is_static, result.get_end())

var closing_paren_index := get_closing_paren_index(opening_paren_index, text)
# Shift the func_def_end index back by one to start on the opening parentheses.
# Because the match_func_with_whitespace().get_end() is the index after the opening parentheses.
var closing_paren_index := get_closing_paren_index(opening_paren_index - 1, text)
if closing_paren_index == -1:
return ""

Expand Down Expand Up @@ -224,7 +226,9 @@ static func edit_vanilla_method(


static func fix_method_super(method_name: String, func_def_end: int, text: String, regex_func_body: RegEx, regex_super_call: RegEx, offset := 0) -> String:
var closing_paren_index := get_closing_paren_index(func_def_end, text)
# Shift the func_def_end index back by one to start on the opening parentheses.
# Because the match_func_with_whitespace().get_end() is the index after the opening parentheses.
var closing_paren_index := get_closing_paren_index(func_def_end - 1, text)
if closing_paren_index == -1:
return text
var func_body_start_index := text.find(":", closing_paren_index) +1
Expand Down