Skip to content

Commit fe5b3b2

Browse files
authored
Merge pull request #325 from boriel/bugfix/crash_unary_error
Fix crash on unary semantic / error
2 parents 023e272 + 0cc4d80 commit fe5b3b2

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)