Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _visit(self, node: ToVisit):
if node.obj is None:
return None

__DEBUG__(f"Optimizer: Visiting node {node.obj!s}", 1)
__DEBUG__(f"Optimizer: Visiting node {node.obj!s}[{node.obj.token}]", 1)
meth = getattr(self, f"visit_{node.obj.token}", self.generic_visit)
return meth(node.obj)

Expand Down
5 changes: 1 addition & 4 deletions src/arch/z80/visitor/translator_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,6 @@ def traverse_const(node):
syntax_error_cant_convert_to_type(node.lineno, str(node.operand), node.type_)
return None

if node.token == "VARARRAY":
return node.data_label

if node.token in ("CONST", "VAR", "LABEL", "FUNCTION"):
# TODO: Check what happens with local vars and params
return node.t
Expand All @@ -238,7 +235,7 @@ def traverse_const(node):
if node.token == "ARRAYACCESS":
return f"({node.entry.data_label} + {node.offset})"

if node.token == "ID" and node.has_address and node.scope == SCOPE.global_:
if node.token in ("ID", "VARARRAY") and node.has_address and node.scope == SCOPE.global_:
return node.mangled

raise InvalidCONSTexpr(node)
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/arch/zx48k/arrlabels1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ _a.__DATA__.__PTR__:
DEFW 0
DEFW 0
_a.__DATA__:
DEFW _a.__DATA__
DEFW _a.__DATA__
DEFW (_a.__DATA__) + (1)
DEFW _a
DEFW _a
DEFW (_a) + (1)
.LABEL.__LABEL0:
DEFW 0000h
DEFB 02h
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/arch/zx48k/arrlabels10a.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ _a.__DATA__.__PTR__:
DEFW 0
DEFW 0
_a.__DATA__:
DEFB (_a.__DATA__) & 0xFF
DEFB ((_a.__DATA__) + (1)) & 0xFF
DEFB (_a) & 0xFF
DEFB ((_a) + (1)) & 0xFF
DEFB 04h
.LABEL.__LABEL0:
DEFW 0000h
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/arch/zx48k/arrlabels10b.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ _a.__DATA__.__PTR__:
DEFW 0
_a.__DATA__:
DEFW 0000h
DEFW (_a.__DATA__) & 0xFFFF
DEFW (_a) & 0xFFFF
DEFW 0000h
DEFW ((_a.__DATA__) + (1)) & 0xFFFF
DEFW ((_a) + (1)) & 0xFFFF
DEFB 00h
DEFB 00h
DEFB 04h
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/arch/zx48k/arrlabels2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ _a.__DATA__.__PTR__:
DEFW _a.__LBOUND__
DEFW 0
_a.__DATA__:
DEFW _a.__DATA__
DEFW _a.__DATA__
DEFW (_a.__DATA__) + (1)
DEFW _a
DEFW _a
DEFW (_a) + (1)
.LABEL.__LABEL0:
DEFW 0000h
DEFB 02h
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/arch/zx48k/arrlabels3.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ _a.__DATA__.__PTR__:
DEFW _a.__LBOUND__
DEFW 0
_a.__DATA__:
DEFW _a.__DATA__
DEFW _a.__DATA__
DEFW (_a.__DATA__) + (_f)
DEFW _a
DEFW _a
DEFW (_a) + (_f)
.LABEL.__LABEL0:
DEFW 0000h
DEFB 02h
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/arch/zx48k/opt1_dim_arr_at1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ _b.__DATA__:
DEFB 02h
.core.ZXBASIC_USER_DATA_END:
.core.__MAIN_PROGRAM__:
ld hl, _a.__DATA__
ld hl, _a
ld (_c), hl
ld hl, _b.__DATA__
ld hl, _b
ld (_c), hl
ld hl, 0
ld b, h
Expand Down