@pineforge/codegen-pyodide 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -469,6 +469,11 @@ class StmtVisitor:
469
469
  return self._type_spec_to_cpp(spec)
470
470
 
471
471
  def _visit_var_decl(self, node: VarDecl, lines: list[str], pad: str) -> None:
472
+ # An array or a matrix whose history the script reads: this execution
473
+ # of its declaration opens a slot, after closing a sibling
474
+ # declaration's (codegen/collection_history.py).
475
+ for statement in self._collection_history_decl_statements(node):
476
+ lines.append(f"{pad}{statement}")
472
477
  member_meta = getattr(
473
478
  self.ctx, "var_member_metadata_by_node", {}
474
479
  ).get(id(node))
@@ -830,7 +835,7 @@ class StmtVisitor:
830
835
  target_cpp_type=(
831
836
  target_cpp_type
832
837
  if target_cpp_type in DRAWING_TYPE_TO_CPP.values()
833
- else None
838
+ else self._series_handle_target(node.name)
834
839
  ),
835
840
  )
836
841
  cpp_val = self._coerce_int_slot(
@@ -1122,6 +1127,11 @@ class StmtVisitor:
1122
1127
  f"{self._udt_array_field_value(array_field, node.value, val_cpp)};")
1123
1128
  elif node.op == ":=":
1124
1129
  val_cpp = self._coerce_int_slot(val_cpp, node.value, field_int)
1130
+ if self._udt_field_is_double(node.target):
1131
+ # An int reaching a float field keeps its na (the
1132
+ # constructor's conversion: fixtures/array_history_tv
1133
+ # uctor_float).
1134
+ val_cpp = self._coerce_double_slot(val_cpp, node.value)
1125
1135
  lines.append(f"{pad}{target_cpp} = {val_cpp};")
1126
1136
  else:
1127
1137
  rhs = self._compound_assign_rhs(target_cpp, node.op, val_cpp)
@@ -1146,9 +1156,9 @@ class StmtVisitor:
1146
1156
  val_cpp = self._visit_rhs_value(
1147
1157
  node.value,
1148
1158
  target_name,
1149
- target_cpp_type=self._drawing_target_cpp_type(
1150
- target_name,
1151
- None,
1159
+ target_cpp_type=(
1160
+ self._drawing_target_cpp_type(target_name, None)
1161
+ or self._series_handle_target(target_name)
1152
1162
  ),
1153
1163
  )
1154
1164
  elem_int = self._int_slot_cpp_type(
@@ -1241,6 +1251,11 @@ class StmtVisitor:
1241
1251
  lines.append(f"{pad}{safe} {node.op} {val_cpp};")
1242
1252
 
1243
1253
  def _visit_tuple_assign(self, node: TupleAssign, lines: list[str], pad: str) -> None:
1254
+ # A tuple declaration writing a member whose history a sibling
1255
+ # block's declaration keeps closes that history first
1256
+ # (codegen/collection_history.py).
1257
+ for statement in self._collection_history_decl_statements(node):
1258
+ lines.append(f"{pad}{statement}")
1244
1259
  is_top_level = any(id(node) == id(stmt) for stmt in self.ctx.ast.body)
1245
1260
  global_targets = (
1246
1261
  set(getattr(self.ctx, "ordinary_global_binding_names", set()))