Skip to content

Commit 6045d3c

Browse files
authored
Merge pull request #1106 from boriel-basic/fix/crash_on_dim_array
fix: crash on dim array with @ operator
2 parents b8d3cd7 + 4b02a4f commit 6045d3c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/arch/z80/visitor/translator.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,9 @@ def default_value(cls, type_: symbols.TYPING, expr: symbols.EXPR) -> list[str]:
10291029
if isinstance(type_, symbols.TYPEREF):
10301030
type_ = type_.final
10311031

1032-
if expr.token in ("CONSTEXPR", "CONST"): # a constant expression like @label + 1
1032+
if expr.token in ("CONSTEXPR", "CONST") or not check.is_number(
1033+
expr
1034+
): # a constant expression like @label + 1, @a(0), etc.
10331035
if type_ in (cls.TYPE(TYPE.float), cls.TYPE(TYPE.string)):
10341036
error(expr.lineno, f"Can't convert non-numeric value to {type_.name} at compile time")
10351037
return ["<ERROR>"] # dummy placeholder so the compilation continues

0 commit comments

Comments
 (0)