Skip to content

Commit

Permalink
Merge pull request #945 from boriel-basic/fix/allow_using_const_strin…
Browse files Browse the repository at this point in the history
…gs_for_dim_init

fix: allow using str CONST in DIM init
  • Loading branch information
boriel authored Jan 4, 2025
2 parents ec12dca + e6c6f6f commit c291eb6
Show file tree
Hide file tree
Showing 3 changed files with 770 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/zxbc/zxbparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def p_var_decl_ini(p):
typedef = sym.TYPEREF(expr.type_, p.lexer.lineno, implicit=True)

value = make_typecast(typedef, expr, p.lineno(4))
defval = value if is_static(expr) else None
defval = value if is_static(expr) and value.type_ != TYPE.string else None

if keyword == "DIM":
SYMBOL_TABLE.declare_variable(idlist[0].name, idlist[0].lineno, typedef, default_value=defval)
Expand Down
Loading

0 comments on commit c291eb6

Please sign in to comment.