Fix: Field list and struct all order
This commit is contained in:
+2
-4
@@ -1,9 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct FieldList(pub HashMap<String, (bool, TypeExpr)>);
|
||||
pub struct FieldList(pub Vec<(String, bool, TypeExpr)>);
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct ParamList(pub Vec<VarDecl>);
|
||||
@@ -83,7 +81,7 @@ pub enum Postfix {
|
||||
FieldAccess(String),
|
||||
Call(Vec<Expression>),
|
||||
MacroCall(String),
|
||||
StructCall(HashMap<String, Expression>),
|
||||
StructCall(Vec<(String, Expression)>),
|
||||
Index(Expression),
|
||||
Binary(BinaryOp, Expression),
|
||||
}
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ impl From<pest::iterators::Pair<'_, Rule>> for FieldList {
|
||||
};
|
||||
let param_type = TypeExpr::from(param_inner.next().unwrap());
|
||||
let param_name = param_inner.next().unwrap().as_str().to_string();
|
||||
(param_name, (export, param_type))
|
||||
(param_name, export, param_type)
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ impl ToRust for TopLevelKind {
|
||||
cg.addln(&format!("{}struct {} {{", vis, name));
|
||||
cg.indent += 1;
|
||||
|
||||
for (field_name, (_, ty)) in &fields.0 {
|
||||
for (field_name, _, ty) in &fields.0 {
|
||||
let ty = ty.get_rust();
|
||||
cg.add_indentedln(&format!("pub {}: {},", field_name, ty));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user