Skip to content
Snippets Groups Projects
Commit 68168d9f authored by George Marchment's avatar George Marchment
Browse files

Fix small ternary operation bug

parent 96db0367
No related branches found
No related tags found
No related merge requests found
Pipeline #14468 failed with stage
in 2 minutes and 13 seconds
...@@ -73,7 +73,7 @@ class Code: ...@@ -73,7 +73,7 @@ class Code:
exp1, exp2 = match.group(4).strip(), match.group(5).strip() exp1, exp2 = match.group(4).strip(), match.group(5).strip()
old = match.group(0) old = match.group(0)
new = f"if ({condition}) {{\n{def_variable} {variable} = {exp1}\n}}\n" new = f"if ({condition}) {{\n{def_variable} {variable} = {exp1}\n}}\n"
new += f"else {{\n{def_variable} {variable} = {exp2}\n}}\n\n" new += f"if (!({condition})) {{\n{def_variable} {variable} = {exp2}\n}}\n\n"
#else {{\n{variable} = {exp2}\n}}\n" #else {{\n{variable} = {exp2}\n}}\n"
#Here we check that it's worked correctly -> that we have done a good parsing #Here we check that it's worked correctly -> that we have done a good parsing
if(get_parenthese_count(condition)==0 and get_parenthese_count(exp1)==0 and get_parenthese_count(exp2)==0 and get_curly_count(condition)==0 and get_curly_count(exp1)==0 and get_curly_count(exp2)==0): if(get_parenthese_count(condition)==0 and get_parenthese_count(exp1)==0 and get_parenthese_count(exp2)==0 and get_curly_count(condition)==0 and get_curly_count(exp1)==0 and get_curly_count(exp2)==0):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment