diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-08-19 21:12:31 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-08-20 13:32:14 +0100 |
commit | 048261647afd1a08f681b78c90c58a9baaeef76d (patch) | |
tree | 47dc551f706c4015c017a299a4054cb7db460857 /gcc/rust/backend/rust-compile-resolve-path.h | |
parent | 1dc718474044149ec1aa6bee9ea8e83d778f17f2 (diff) | |
download | gcc-048261647afd1a08f681b78c90c58a9baaeef76d.zip gcc-048261647afd1a08f681b78c90c58a9baaeef76d.tar.gz gcc-048261647afd1a08f681b78c90c58a9baaeef76d.tar.bz2 |
Add qualified path support
Qualified paths need to lookup the associated trait item and mangle the
names apropriatly.
Diffstat (limited to 'gcc/rust/backend/rust-compile-resolve-path.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-resolve-path.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-resolve-path.h b/gcc/rust/backend/rust-compile-resolve-path.h index 30486d0..41067c8 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.h +++ b/gcc/rust/backend/rust-compile-resolve-path.h @@ -30,6 +30,14 @@ class ResolvePathRef : public HIRCompileBase using Rust::Compile::HIRCompileBase::visit; public: + static Bexpression *Compile (HIR::QualifiedPathInExpression &expr, + Context *ctx) + { + ResolvePathRef resolver (ctx); + expr.accept_vis (resolver); + return resolver.resolved; + } + static Bexpression *Compile (HIR::PathInExpression &expr, Context *ctx) { ResolvePathRef resolver (ctx); @@ -39,8 +47,16 @@ public: void visit (HIR::PathInExpression &expr) override; + void visit (HIR::QualifiedPathInExpression &expr) override; + private: - ResolvePathRef (Context *ctx) : HIRCompileBase (ctx), resolved (nullptr) {} + ResolvePathRef (Context *ctx) + : HIRCompileBase (ctx), resolved (ctx->get_backend ()->error_expression ()) + {} + + void resolve (const HIR::PathIdentSegment &final_segment, + const Analysis::NodeMapping &mappings, Location locus, + bool is_qualified_path); Bexpression *resolved; }; |