Skip to content

Commit 0cc4d80

Browse files
committed
Fix crash on unary semantic / error
1 parent 023e272 commit 0cc4d80

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

tests/functional/unary_crash.bas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
a = -b(4)
3+

zxb/zxbparser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ def make_binary(lineno, operator, left, right, func=None, type_=None):
190190
def make_unary(lineno, operator, operand, func=None, type_=None):
191191
""" Wrapper: returns a Unary node
192192
"""
193+
if operand is None: # syntax / semantic error
194+
return None
195+
193196
return symbols.UNARY.make_node(lineno, operator, operand, func, type_)
194197

195198

0 commit comments

Comments
 (0)