# Add struct support
## Changes
### 1. `ast.rs` — add struct defs to TranslationUnit
```rust
pub struct TranslationUnit {
pub decls: Vec<Decl>,
pub functions: Vec<FunctionDef>,
pub structs: HashMap<String, Vec<(String, CType)>>,
}
```
### 2. `typecheck.rs`
- Populate `unit.structs` from the typechecker's struct map.
- Anonymous structs (`ss.name == None`): assign synthetic names (`__anon_0`, etc.) so they can be stored/looked up.
- Resolve typedefs eagerly: when `check_decl` produces `CType::Typedef(name)`, look it up in scope to get the underlying type. This way `s v;` (where `s` is typedef for a struct) gives `v` type `CType::Struct(...)` directly.
### 3. `codegen.rs`
- Build struct layouts from `unit.structs`: compute `(field_name, byte_offset, field_type)` with natural alignment.
- `type_size(Struct(name))`: look up layout, return total size.
- `Member(obj, field)`: emit obj (address), `addq $offset, %rax`.
- `PtrMember(obj, field)`: emit obj (pointer value), `addq $offset, %rax`.
- Stack allocation: use actual struct size instead of 8.
### 4. `main.rs`, `grammar.rs`, `tests/codegen.rs`
- Adapt to new `TranslationUnit` struct (add `structs: HashMap::new()` where constructed).
- Update PASSING list with newly passing tests.