Commit f8f0aca1 authored by Roman Alifanov's avatar Roman Alifanov

Fix namespace-level variable handling in IR builder

- _build_namespace() now processes assignments and other statements, not just FunctionDecl/ClassDecl - _build_assignment() resolves symbol via bash_name() so namespace variables get correct prefix (e.g. gtk3__GTK3_SCHEMA)
parent 08862c2c
......@@ -168,6 +168,10 @@ class IRBuilder:
elif isinstance(stmt, ClassDecl):
cl = self._build_class(stmt, namespace=node.name)
ir.classes.append(cl)
elif not isinstance(stmt, (UsingStmt, ErrorNode)):
ir_stmt = self._build_stmt(stmt)
if ir_stmt:
ir.top_stmts.append(ir_stmt)
self._scope = saved
......@@ -415,7 +419,9 @@ class IRBuilder:
if isinstance(value, IRAsync):
self._async_vars.add(target.name)
is_env = target.name.startswith('env.')
return IRAssign(target=target.name, value=value, op=op,
sym = self._resolve_name(target.name)
bash_target = sym.bash_name() if sym else target.name
return IRAssign(target=bash_target, value=value, op=op,
is_export=is_env, source=loc)
if isinstance(target, MemberAccess):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment