field exporting

This commit is contained in:
2026-04-17 12:56:08 +02:00
parent d2f7c0c69b
commit ec30d18e15
7 changed files with 56 additions and 31 deletions
+30 -12
View File
@@ -47,12 +47,21 @@ impl FunctionSymbol {
Self {
export: export,
name: name.clone(),
params: params.to_hashmap(|name, v| VarSymbol {
name: name.clone(),
var_type: TypeSymbol(match v {
TypeExpr::Identifier(i) => i.to_string(),
}),
}),
params: params
.0
.iter()
.map(|(name, (_, v))| {
(
name.clone(),
VarSymbol {
name: name.clone(),
var_type: TypeSymbol(match v {
TypeExpr::Identifier(i) => i.to_string(),
}),
},
)
})
.collect(),
return_type: return_type.map(TypeSymbol::from_ast),
}
}
@@ -63,12 +72,21 @@ impl StructSymbol {
Self {
export,
name,
fields: fields.to_hashmap(|name, v| VarSymbol {
name: name.clone(),
var_type: TypeSymbol(match v {
TypeExpr::Identifier(i) => i.to_string(),
}),
}),
fields: fields
.0
.iter()
.map(|(name, (_, v))| {
(
name.clone(),
VarSymbol {
name: name.clone(),
var_type: TypeSymbol(match v {
TypeExpr::Identifier(i) => i.to_string(),
}),
},
)
})
.collect(),
// TODO - parse struct methods
methods: HashMap::new(),
}