Skip to content

Commit 3571d9d

Browse files
authored
Merge pull request #329 from boriel/bugfix/CODE_bug
Fix bug in CODE freeing string when it shouldn't
2 parents f18c13f + 76c45d7 commit 3571d9d

5 files changed

Lines changed: 1841 additions & 2 deletions

File tree

arch/zx48k/translator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ def visit_IN(self, node):
11791179

11801180
def visit_CODE(self, node):
11811181
self.ic_fparam(gl.PTR_TYPE, node.operand.t)
1182-
if node.operand.token != 'STRING' and node.operand.token != 'VAR' and node.operand.t != '_':
1182+
if node.operand.token not in ('STRING', 'VAR', 'PARAMDECL') and node.operand.t != '_':
11831183
self.ic_fparam(TYPE.ubyte, 1) # If the argument is not a variable, it must be freed
11841184
else:
11851185
self.ic_fparam(TYPE.ubyte, 0)
@@ -1202,7 +1202,7 @@ def visit_LEN(self, node):
12021202

12031203
def visit_VAL(self, node):
12041204
self.ic_fparam(gl.PTR_TYPE, node.operand.t)
1205-
if node.operand.token not in ('STRING', 'VAR') and node.operand.t != '_':
1205+
if node.operand.token not in ('STRING', 'VAR', 'PARAMDECL') and node.operand.t != '_':
12061206
self.ic_fparam(TYPE.ubyte, 1) # If the argument is not a variable, it must be freed
12071207
else:
12081208
self.ic_fparam(TYPE.ubyte, 0)

0 commit comments

Comments
 (0)