diff options
author | Philip Herron <philip.herron@embecosm.com> | 2020-12-30 22:13:41 +0000 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2021-01-06 10:01:17 +0000 |
commit | 36ebe9a0380694c8517536eb37c7134f1323a30b (patch) | |
tree | 06901ff25aa5ea093184e0713bd0363735408959 /gcc/rust/backend/rust-compile-resolve-path.cc | |
parent | 467141184aa274126ff7e2a41d08bb621b7a3fdf (diff) | |
download | gcc-36ebe9a0380694c8517536eb37c7134f1323a30b.zip gcc-36ebe9a0380694c8517536eb37c7134f1323a30b.tar.gz gcc-36ebe9a0380694c8517536eb37c7134f1323a30b.tar.bz2 |
This brings structs back in post HIR changes. It supports structs
where no base struct is referenced and the constructor is in order.
Diffstat (limited to 'gcc/rust/backend/rust-compile-resolve-path.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-resolve-path.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc index c5c646d..c24005e 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.cc +++ b/gcc/rust/backend/rust-compile-resolve-path.cc @@ -25,7 +25,7 @@ namespace Rust { namespace Compile { void -ResolvePath::visit (HIR::PathInExpression &expr) +ResolvePathRef::visit (HIR::PathInExpression &expr) { // need to look up the reference for this identifier NodeId ref_node_id; @@ -70,5 +70,33 @@ ResolvePath::visit (HIR::PathInExpression &expr) = ctx->get_backend ()->function_code_expression (fn, expr.get_locus ()); } +void +ResolvePathType::visit (HIR::PathInExpression &expr) +{ + // need to look up the reference for this identifier + NodeId ref_node_id; + if (!ctx->get_resolver ()->lookup_resolved_name ( + expr.get_mappings ().get_nodeid (), &ref_node_id)) + { + rust_fatal_error (expr.get_locus (), "failed to look up resolved name"); + return; + } + + HirId ref; + if (!ctx->get_mappings ()->lookup_node_to_hir ( + expr.get_mappings ().get_crate_num (), ref_node_id, &ref)) + { + rust_fatal_error (expr.get_locus (), "reverse lookup failure"); + return; + } + + // assumes paths are functions for now + if (!ctx->lookup_compiled_types (ref, &resolved)) + { + rust_fatal_error (expr.get_locus (), "forward decl was not compiled"); + return; + } +} + } // namespace Compile } // namespace Rust |