Add array literals
This commit is contained in:
parent
84ccd167f7
commit
4b3a09c4d5
1 changed files with 6 additions and 1 deletions
|
|
@ -311,7 +311,12 @@ impl Transpiler {
|
|||
enum_name, variant_index, union_field_name, variant_struct_name, struct_init
|
||||
)
|
||||
}
|
||||
_ => "// TODO: unimplemented expr".to_string(),
|
||||
|
||||
CExpr::ArrayLit(array_lit) => {
|
||||
let vec = array_lit.iter().map(|expr| self.generate_expr(expr)).collect::<Vec<_>>();
|
||||
let len = vec.len();
|
||||
format!("{}[{}]{{ {} }}", vec[0], len, vec.join(", "))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue