Skip to content

Commit 91b4434

Browse files
committed
bugfix with Empty class in Interpreter
Fix issue #5
1 parent c1d41ca commit 91b4434

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

CheLang/Interpreter.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,16 @@ def visit_IfNode(self, node, context):
166166
expr_value = res.register(self.visit(expr, context))
167167
# if res.error: return res
168168
if res.should_return(): return res
169-
return res.success(Empty if should_return_null else expr_value)
169+
return res.success(Empty() if should_return_null else expr_value)
170170

171171
if node.else_case:
172172
expr, should_return_null = node.else_case
173173
else_value = res.register(self.visit(expr, context))
174174
# if res.error: return res
175175
if res.should_return(): return res
176-
return res.success(Empty if should_return_null else else_value)
176+
return res.success(Empty() if should_return_null else else_value)
177177

178-
return res.success(Empty)
178+
return res.success(Empty())
179179

180180
###############################
181181
# FOR NODE VISIT METHOD
@@ -223,7 +223,7 @@ def visit_ForNode(self, node, context):
223223
elements.append(value)
224224

225225
return res.success(
226-
Empty if node.should_return_null else
226+
Empty() if node.should_return_null else
227227
List(elements).set_context(context).set_pos(node.pos_start, node.pos_end)
228228
)
229229

@@ -253,7 +253,7 @@ def visit_WhileNode(self, node, context):
253253
elements.append(value)
254254

255255
return res.success(
256-
Empty if node.should_return_null else
256+
Empty() if node.should_return_null else
257257
List(elements).set_context(context).set_pos(node.pos_start, node.pos_end)
258258
)
259259
###############################

changelog

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ scheme:
88
changes
99
changes
1010
) commit
11-
19/06
11+
19/06 v1.1.1
1212
(
1313
changed keywords "run" => "Correme", "len" => "TaLargo"
1414
added actual folder in console
@@ -21,7 +21,10 @@ scheme:
2121
updated context name of built-in function
2222
built-in functions declaration in self file
2323
)
24-
18/06
24+
(
25+
bugfix with Empty class in Interpreter
26+
)
27+
18/06 v1.1.0
2528
(
2629
"Ninos()" built-in function added as exit()
2730
changed keywords "for" => "agarra por", "to" => "hasta", "step" => "de a "

0 commit comments

Comments
 (0)