Fixed array expr

This commit is contained in:
2026-06-05 12:38:25 +02:00
parent d5501ef25e
commit 595ddc789d
4 changed files with 37 additions and 24 deletions
+16 -18
View File
@@ -48,24 +48,6 @@ impl GenRust for Literal {
cg.add(")");
}
Self::Array(values) => {
cg.add("[");
for val in values {
val.gen_rust(ctx, cg);
}
cg.add("]");
}
Self::ArrayRepeat(value, repeat) => {
cg.add("[");
value.gen_rust(ctx, cg);
cg.add("; ");
repeat.gen_rust(ctx, cg);
cg.add("]");
}
}
}
}
@@ -84,6 +66,22 @@ impl GenRust for Expression {
Expression::Path(path) => cg.add(&path.get_rust()),
Expression::Literal(literal) => literal.gen_rust(ctx, cg),
Expression::Statement(stmt) => stmt.gen_rust(ctx, cg),
Expression::Array(values) => {
cg.add("[");
for val in values {
val.gen_rust(ctx, cg);
}
cg.add("]");
}
Expression::ArrayRepeat(value, repeat) => {
cg.add("[");
value.gen_rust(ctx, cg);
cg.add("; ");
repeat.gen_rust(ctx, cg);
cg.add("]");
}
Expression::Fix {
initial,
prefixes,