mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-28 18:54:56 +01:00
I believe this PR is sufficient to pull in all current class features, including the current bits of inheritance which have been implemented. Because a class declaration can reference its own type, this creates an incomplete type prior to constant loading. Right now, the object representation is imported proactively, but individual fields are left as ImportRefUnused. This means that member functions and similar will only be imported if called. This also adjusts how function parameters are being handled, to match the expectations of Self param structure. When formatting, I'm starting to look into constants. Otherwise we get "unexpected instref". Overall, there are a few things that may be worth further discussion: - The lack of a constant corresponding to the ClassType on ClassDecl is inconvenient -- I'd like to see how zygoloid feels about trying to restructure this. i.e., I'm setting a constant in order to be able to track things down later, it'd be nice if the normal IR did this simply for consistency, or if we were able to combine these rather than having separate instructions. - Should we shift the parse node tracking further, and go with a setup wherein imports can embed import references into that? e.g., negative values go to another array which includes a ImportIRId for printing diagnostics, replacing the invalid NodeId. - Can the formatter switch to a more general scan of instructions for naming, to eliminate the ImportRef constant approach added here? - GetExprValueForLookupResult special-casing instructions felt surprising, I might see if there's a way to restructure to avoid that. But I think these issues are things that can be separated out.