diff options
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; |