From fb27d1452b31d5485b1fce692f14279472cf0baf Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Mon, 4 Jul 2022 16:56:46 +0100 Subject: Refactor mappings class and HIR lowering to be consistent In order to support loading extern crates and use statements we needed to clarify the usage of NodeId and HirId within gccrs. Each of these id's were nested behind the CrateNum but the type resolution, linting and code-gen passes do not support that level of nesting. In order to get metadata exports and imports working lets focus on gccrs supporting compilation of a single crate at a time. This means the crate prefix only matters for imports and limits the complexity here. Down the line there might be a way to leverage DefId's for all Path resolution which could solve this problem but significant refactoring would be required here to do this properly and its not nessecary for a basic working rust compiler. --- gcc/rust/ast/rust-item.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/rust/ast') diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h index 94ffffb..4987674 100644 --- a/gcc/rust/ast/rust-item.h +++ b/gcc/rust/ast/rust-item.h @@ -1153,6 +1153,9 @@ public: void accept_vis (ASTVisitor &vis) override; + const std::string &get_referenced_crate () const { return referenced_crate; } + const std::string &get_as_clause () const { return as_clause_name; } + // Override that adds extern crate name in decl to passed list of names. void add_crate_name (std::vector &names) const override { -- cgit v1.1