cl toType: support TypeElaborated - #727
Conversation
There was a problem hiding this comment.
Review: support TypeElaborated in toType
This PR registers named class/typedef types into a new ctx.types cache (c/c++ type spelling => types.Type) and resolves elaborated types through it in toType, alongside moving loadMacro/loadTypedef from deferred ctx.compiles closures into the eager load phase. Direction is clean and the new golden fixtures verify cross-type field resolution (bar::base field -> Bar_base).
A few things worth addressing before merge — see inline comments. The main one is that an unresolved elaborated type falls through to the generic panic("todo: toType ..."), which is both hard to diagnose and a forward-reference hazard now that type resolution runs eagerly.
Non-blocking note: the two writers of ctx.types (class.go:74, compile.go:246) write blindly with no duplicate-key check. A forward-declared class and its later definition can silently overwrite. A deliberate last-writer-wins is fine, but a guard (or a short comment stating the intent) would make the invariant explicit.
No description provided.