gccrs: Allow merge of CanonicalPath context
gccrs enables merging of CanonicalPath contexts by changing parent handling.
gccrs can now merge CanonicalPath contexts thanks to a new function that merges one context into another. This commit also adjusts how parent handles are stored, changing from direct references to storing parent node IDs. This modification prevents breakage caused by the merge operation and simplifies context management.
In Details
The gccrs name resolution context has been enhanced to allow merging CanonicalPathCtx instances. This required changing the CanonicalPathRecord internal representation to store parent node IDs instead of direct parent references. The NameResolutionContext::merge function now correctly merges these contexts, ensuring that path resolution remains consistent after merging, which is crucial for complex module structures.
- gccrs
- The Rust frontend for GCC, enabling the compilation of Rust code using the GCC compiler infrastructure.
- CanonicalPath
- A data structure representing a fully qualified path in the Rust code, used during name resolution.
- Name Resolution
- The process by which the compiler determines the meaning of identifiers (variables, functions, types, etc.) in the code, ensuring they refer to the correct entities.
- node ID
- An identifier for a node in the compiler's internal representation, such as the Abstract Syntax Tree (AST) or the High-level Intermediate Representation (HIR).