diff --git a/hblang/src/codegen.rs b/hblang/src/codegen.rs index 2851bbc4..bb164eda 100644 --- a/hblang/src/codegen.rs +++ b/hblang/src/codegen.rs @@ -251,7 +251,7 @@ struct Loop { } struct Struct { - name: Rc, + id: Ident, fields: Vec<(Rc, Type)>, } @@ -397,6 +397,18 @@ impl<'a> Codegen<'a> { fn expr(&mut self, expr: &'a parser::Expr<'a>, expeted: Option) -> Option { match *expr { + E::BinOp { + left: E::Ident { id, .. }, + op: T::Decl, + right: E::Struct { fields, .. }, + } => { + let fields = fields + .iter() + .map(|&(name, ty)| (name.into(), self.ty(&ty))) + .collect(); + self.records.push(Struct { id: *id, fields }); + None + } E::UnOp { op: T::Amp, val, .. } => {