Skip to content

Commit d465e43

Browse files
committed
Fixed if statement conditions being lists
1 parent d8162e8 commit d465e43

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

code_generator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def generate_IfNode(self, node):
7676
if isinstance(condition, str):
7777
condition_code += condition
7878
else:
79-
condition_code += self.generate(condition[0], is_root=False)
79+
condition_code += self.generate(condition, is_root=False)
8080
print(condition_code)
8181
body_code = ''
8282
for body in node.body:

custom_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def parse_if_statement(self, line):
108108
while i < len(tokens) and tokens[i].type not in condition_identifiers:
109109
condition_part.append(tokens[i])
110110
i += 1
111-
condition.append([self.parse_expression(condition_part)])
111+
condition.append(self.parse_expression(condition_part))
112112
if i == len(tokens):
113113
break
114114
condition.append(tokens[i].type)

0 commit comments

Comments
 (0)