diff options
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-expr.h | 19 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-expr.h | 6 |
2 files changed, 25 insertions, 0 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-expr.h b/gcc/rust/hir/rust-ast-lower-expr.h index 701efd5..1003e8c 100644 --- a/gcc/rust/hir/rust-ast-lower-expr.h +++ b/gcc/rust/hir/rust-ast-lower-expr.h @@ -525,6 +525,25 @@ public: inner_attribs, outer_attribs); } + void visit (AST::GroupedExpr &expr) + { + std::vector<HIR::Attribute> inner_attribs; + std::vector<HIR::Attribute> outer_attribs; + + HIR::Expr *paren_expr + = ASTLoweringExpr::translate (expr.get_expr_in_parens ().get ()); + + auto crate_num = mappings->get_current_crate (); + Analysis::NodeMapping mapping (crate_num, expr.get_node_id (), + mappings->get_next_hir_id (crate_num), + UNKNOWN_LOCAL_DEFID); + + translated + = new HIR::GroupedExpr (mapping, std::unique_ptr<HIR::Expr> (paren_expr), + std::move (inner_attribs), + std::move (outer_attribs), expr.get_locus ()); + } + private: ASTLoweringExpr () : translated (nullptr), translated_array_elems (nullptr), terminated (false) diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h index 0d67086..bb8499a 100644 --- a/gcc/rust/hir/tree/rust-hir-expr.h +++ b/gcc/rust/hir/tree/rust-hir-expr.h @@ -880,6 +880,12 @@ public: void accept_vis (HIRVisitor &vis) override; + std::unique_ptr<Expr> &get_expr_in_parens () + { + rust_assert (expr_in_parens != nullptr); + return expr_in_parens; + } + protected: /* Use covariance to implement clone function as returning this object rather * than base */ |