mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-29 22:02:42 +01:00
A symbolic constant has an instruction to compute the constant value, as well as potentially also having a generic ID and an index within that generic to indicate where corresponding values can be found in a specific. Import those pieces of information when importing such a constant. We try to import the generic before we start the main work of importing the constant, and retry the import process if importing the generic adds work to the worklist. This means that the first time we import anything within a generic, we can now perform three passes calling `TryResolveInst` instead of two, but the first pass is very lightweight and only looks up and adds a single instruction, so the added overhead of the extra pass should be minimal. To avoid introducing cycles when importing a generic function, make the import of a function declaration build the new `Function`, `FunctionDecl`, and `FunctionType` in the first pass, like classes and interfaces do.