aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/snippets_translate/converter.py2
-rw-r--r--tools/snippets_translate/tests/test_converter.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/tools/snippets_translate/converter.py b/tools/snippets_translate/converter.py
index 4238ca597..c3ddf7d77 100644
--- a/tools/snippets_translate/converter.py
+++ b/tools/snippets_translate/converter.py
@@ -92,6 +92,8 @@ def snippet_translate(x):
# that include the string 'new'
if "new " in x:
x = x.replace("new ", "")
+ if not x.endswith(")"): # "new Foo" -> "new Foo()"
+ x += "()"
# Handle 'const'
# Some variables/functions have the word 'const' so we explicitly
diff --git a/tools/snippets_translate/tests/test_converter.py b/tools/snippets_translate/tests/test_converter.py
index 3c7ed7b70..cf313749d 100644
--- a/tools/snippets_translate/tests/test_converter.py
+++ b/tools/snippets_translate/tests/test_converter.py
@@ -64,7 +64,7 @@ def test_else():
def test_new():
assert st("a = new Something(...);") == "a = Something(...)"
- assert st("a = new Something") == "a = Something"
+ assert st("a = new Something") == "a = Something()"
def test_semicolon():