Rust: distinguish [a, b] from [a; b]

This splits the `ArrayExpr` class into `ArrayListExpr` and `ArrayRepeatExpr`.
This uses the `synth.from_class` machinery to integrate seamlessly into the
generated code, by hiding the extracted `ArrayExpr` behind an internal class
and replacing it with a hierarchy of those two classes under a new
`ArrayExpr` class.
This commit is contained in:
Paolo Tranquilli
2024-12-03 15:09:20 +01:00
parent 06b1d8e448
commit 353f1cafe6
49 changed files with 724 additions and 164 deletions

View File

@@ -303,7 +303,7 @@ closure_binder_generic_param_lists(
);
@expr =
@array_expr
@array_expr_internal
| @asm_expr
| @await_expr
| @become_expr
@@ -1087,24 +1087,29 @@ where_pred_type_bound_lists(
int type_bound_list: @type_bound_list ref
);
array_exprs(
unique int id: @array_expr
array_expr_internals(
unique int id: @array_expr_internal
);
#keyset[id, index]
array_expr_attrs(
int id: @array_expr ref,
array_expr_internal_attrs(
int id: @array_expr_internal ref,
int index: int ref,
int attr: @attr ref
);
#keyset[id, index]
array_expr_exprs(
int id: @array_expr ref,
array_expr_internal_exprs(
int id: @array_expr_internal ref,
int index: int ref,
int expr: @expr ref
);
#keyset[id]
array_expr_internal_is_semicolon(
int id: @array_expr_internal ref
);
array_types(
unique int id: @array_type
);