diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-08-12 16:19:05 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-08-19 15:30:23 +0100 |
commit | 1e74f08c141eca935005d45840f2b77acbf63531 (patch) | |
tree | afc2d4f4f2cbefcadc5f2da6caa91bff59c0c342 /gcc/rust/hir/rust-ast-lower-expr.h | |
parent | 3475f10cbf58ff748298be438a4bf8cf98fec4ab (diff) | |
download | gcc-1e74f08c141eca935005d45840f2b77acbf63531.zip gcc-1e74f08c141eca935005d45840f2b77acbf63531.tar.gz gcc-1e74f08c141eca935005d45840f2b77acbf63531.tar.bz2 |
Add QualifiedTypePath HIR lowering
QualifiedTypePath resolution differs from normal PathInExpressions and can
resolve to trait items this adds the hir lowering for this.
Diffstat (limited to 'gcc/rust/hir/rust-ast-lower-expr.h')
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-expr.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-expr.h b/gcc/rust/hir/rust-ast-lower-expr.h index 1c48651..3415567 100644 --- a/gcc/rust/hir/rust-ast-lower-expr.h +++ b/gcc/rust/hir/rust-ast-lower-expr.h @@ -48,6 +48,28 @@ private: HIR::PathInExpression *translated; }; +class ASTLowerQualPathInExpression : public ASTLoweringBase +{ + using Rust::HIR::ASTLoweringBase::visit; + +public: + static HIR::QualifiedPathInExpression * + translate (AST::QualifiedPathInExpression *expr) + { + ASTLowerQualPathInExpression compiler; + expr->accept_vis (compiler); + rust_assert (compiler.translated); + return compiler.translated; + } + + void visit (AST::QualifiedPathInExpression &expr) override; + +private: + ASTLowerQualPathInExpression () : translated (nullptr) {} + + HIR::QualifiedPathInExpression *translated; +}; + class ASTLoweringExpr : public ASTLoweringBase { using Rust::HIR::ASTLoweringBase::visit; @@ -145,6 +167,11 @@ public: translated = ASTLowerPathInExpression::translate (&expr); } + void visit (AST::QualifiedPathInExpression &expr) override + { + translated = ASTLowerQualPathInExpression::translate (&expr); + } + void visit (AST::ReturnExpr &expr) override { terminated = true; |