aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-15 15:44:12 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-04-16 11:04:56 +0000
commit2cceb85c30995f94d69516eff519e7d7d2aa941f (patch)
tree889af10dac55e34481895a96c651a8ffcb273df8 /tools
parentc9dc7bbf201a9fd20469041cca7459f02cb2fc68 (diff)
snippets_translate: Do not crash on multi-line emit statements
qtbase/0e69349f6f8e9445877ea5b2105973115ad79cf7 introduced a multi-line emit statement, causing snippets_translate to fail. Add a warning message which then shows: snippets_translate: Warning "emit renderedImage(result, resultSize," does not match function call Change-Id: Id27770eab1e60d7828e7d742e63d1de2d530ad02 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/snippets_translate/handlers.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/snippets_translate/handlers.py b/tools/snippets_translate/handlers.py
index b8ee9f219..510498a30 100644
--- a/tools/snippets_translate/handlers.py
+++ b/tools/snippets_translate/handlers.py
@@ -38,6 +38,7 @@
#############################################################################
import re
+import sys
from parse_utils import get_indent, dstrip, remove_ref, parse_arguments, replace_main_commas, get_qt_module_class
@@ -387,7 +388,13 @@ def handle_negate(x):
def handle_emit(x):
function_call = x.replace("emit ", "").strip()
re_content = re.compile(r"\((.*)\)")
- arguments = re_content.search(function_call).group(1)
+ match = re_content.search(function_call)
+ if not match:
+ stmt = x.strip()
+ print(f'snippets_translate: Warning "{stmt}" does not match function call',
+ file=sys.stderr)
+ return ''
+ arguments = match.group(1)
method_name = function_call.split("(")[0].strip()
return f"{get_indent(x)}{method_name}.emit({arguments})"