globals is special

This commit is contained in:
J. Nick Koston
2026-03-22 11:23:46 -10:00
parent d30f3100bd
commit 85c970e1dd
4 changed files with 48 additions and 1 deletions
+5 -1
View File
@@ -600,7 +600,11 @@ def Pvariable(id_: ID, rhs: SafeExpType, type_: "MockObj" = None) -> "MockObj":
)
# Extract args from the CallExpression and rebuild as placement new
call_expr = rhs.base # CallExpression("new Type", args...)
placement_new = CallExpression(f"new({id_.id}) {the_type}", *call_expr.args)
placement_args: list[Expression] = []
if call_expr.template_args is not None:
placement_args.append(call_expr.template_args)
placement_args.extend(call_expr.args)
placement_new = CallExpression(f"new({id_.id}) {the_type}", *placement_args)
CORE.add(ExpressionStatement(placement_new))
else:
decl = VariableDeclarationExpression(id_.type, "*", id_, static=True)