diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-08-14 18:19:06 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-08-19 15:30:19 +0100 |
commit | 3475f10cbf58ff748298be438a4bf8cf98fec4ab (patch) | |
tree | b8d15877eb5f6790d4a382acb66746c10fab2a04 /gcc/rust/resolve/rust-ast-resolve-expr.h | |
parent | 71cf0d44d3fceb235c95d5acaf92b498f8cf923b (diff) | |
download | gcc-3475f10cbf58ff748298be438a4bf8cf98fec4ab.zip gcc-3475f10cbf58ff748298be438a4bf8cf98fec4ab.tar.gz gcc-3475f10cbf58ff748298be438a4bf8cf98fec4ab.tar.bz2 |
Add QualifiedPathInExpression name resolution
Qualified paths such as: <Foo as Bar>::A give the ability to resolve to
trait-impls or trait-items directly. It is a type of projection.
Remember trait impl blocks have the relevant canonical path so we can
resolve with canonical paths and reuse the existing path in expression
code.
Diffstat (limited to 'gcc/rust/resolve/rust-ast-resolve-expr.h')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-expr.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.h b/gcc/rust/resolve/rust-ast-resolve-expr.h index e7e37d4..c5f88f9 100644 --- a/gcc/rust/resolve/rust-ast-resolve-expr.h +++ b/gcc/rust/resolve/rust-ast-resolve-expr.h @@ -39,10 +39,22 @@ public: resolver.resolve_path (expr); } + static void go (AST::QualifiedPathInExpression *expr, NodeId parent) + { + ResolvePath resolver (parent); + resolver.resolve_path (expr); + } + private: ResolvePath (NodeId parent) : ResolverBase (parent) {} void resolve_path (AST::PathInExpression *expr); + + void resolve_path (AST::QualifiedPathInExpression *expr); + + void resolve_segments (CanonicalPath prefix, size_t offs, + std::vector<AST::PathExprSegment> &segs, + NodeId expr_node_id, Location expr_locus); }; class ResolveExpr : public ResolverBase @@ -75,6 +87,11 @@ public: ResolvePath::go (&expr, parent); } + void visit (AST::QualifiedPathInExpression &expr) override + { + ResolvePath::go (&expr, parent); + } + void visit (AST::ReturnExpr &expr) override { if (expr.has_returned_expr ()) |