diff --git a/src/parsing.cpp b/src/parsing.cpp index a1f6a9f..1c56f88 100644 --- a/src/parsing.cpp +++ b/src/parsing.cpp @@ -549,6 +549,13 @@ namespace parsing { auto ty = parse_type(inner, scope).unwrap(); inner.expect(token::Type::Symbol, ";"); + if (ty->m_kind == types::TypeKind::Struct) { + auto struct_ty = dynamic_cast(ty.get()); + if (!struct_ty->m_is_ref && struct_ty->m_name) { + scope.structs[*struct_ty->m_name] = ty; + } + } + stream.m_position = inner.m_position; auto tl_typedef = new AST::TopLevelTypedef{ before_meta + stream.metadata(), ty