diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-08-15 13:16:27 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-08-16 11:35:48 +0200 |
| commit | beaf2513cbe23f0a40162df1cd454c278fc7a1d1 (patch) | |
| tree | 2fb194434d6757e22f565fcecca072663064ce3b /tools/snippets_translate/handlers.py | |
| parent | 6cad6d81a97900bd98234bc6434d68f65578a539 (diff) | |
snippets_translate: Do convert return statements to functions
Pick-to: 6.3 6.2
Task-number: PYSIDE-2030
Change-Id: Icd6f3a639449d737933d4420fbeb891224999b59
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'tools/snippets_translate/handlers.py')
| -rw-r--r-- | tools/snippets_translate/handlers.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/snippets_translate/handlers.py b/tools/snippets_translate/handlers.py index 0e0508a4f..b749f04b8 100644 --- a/tools/snippets_translate/handlers.py +++ b/tools/snippets_translate/handlers.py @@ -480,10 +480,13 @@ def handle_methods_return_type(x): def handle_functions(x): - re_capture = re.compile(r"^ *[a-zA-Z0-9]+ ([\w\*\&]+\(.*\)$)") + re_capture = re.compile(r"^ *([a-zA-Z0-9]+) ([\w\*\&]+\(.*\)$)") capture = re_capture.search(x) if capture: - content = capture.group(1) + return_type = capture.group(1) + if return_type == "return": # "return QModelIndex();" + return x + content = capture.group(2) function_name = content.split("(")[0] re_par = re.compile(r"\((.+)\)") par_capture = re_par.search(x) |
