From b92a9b80faa4b6daeca3e94db8bcdebdeec0b859 Mon Sep 17 00:00:00 2001 From: "@mvvsmk" Date: Thu, 3 Feb 2022 07:27:20 +0530 Subject: Upated parameterised constuctor of MatchArm to take location data Addresses issue #863 1)comment removed form rust-expr.h 2)changed partameterized constructor and static function in rust-hir-expr.h 3)changed line 697 to pass expr.get_locus() in rust-ast-lower 4)changed parameterised constructor in rust-expr.h 5)changed line 8563 in rust-parse-impl.h to pass location data. Signed-off-by : M V V S Manoj Kumar --- gcc/rust/hir/rust-ast-lower-expr.h | 2 +- gcc/rust/hir/tree/rust-hir-expr.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/rust/hir') diff --git a/gcc/rust/hir/rust-ast-lower-expr.h b/gcc/rust/hir/rust-ast-lower-expr.h index 8cd4fb5..1aa21bd 100644 --- a/gcc/rust/hir/rust-ast-lower-expr.h +++ b/gcc/rust/hir/rust-ast-lower-expr.h @@ -693,7 +693,7 @@ public: match_arm_patterns.push_back (std::unique_ptr (ptrn)); } - HIR::MatchArm arm (std::move (match_arm_patterns), + HIR::MatchArm arm (std::move (match_arm_patterns), expr.get_locus (), std::unique_ptr (kase_guard_expr), match_case.get_arm ().get_outer_attrs ()); diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h index 89b9f64..3267d01 100644 --- a/gcc/rust/hir/tree/rust-hir-expr.h +++ b/gcc/rust/hir/tree/rust-hir-expr.h @@ -3721,9 +3721,8 @@ public: // Constructor for match arm with a guard expression MatchArm (std::vector > match_arm_patterns, - std::unique_ptr guard_expr = nullptr, - AST::AttrVec outer_attrs = AST::AttrVec (), - Location locus = Location ()) + Location locus, std::unique_ptr guard_expr = nullptr, + AST::AttrVec outer_attrs = AST::AttrVec ()) : outer_attrs (std::move (outer_attrs)), match_arm_patterns (std::move (match_arm_patterns)), guard_expr (std::move (guard_expr)), locus (locus) @@ -3770,7 +3769,8 @@ public: // Creates a match arm in an error state. static MatchArm create_error () { - return MatchArm (std::vector > ()); + Location locus = Location (); + return MatchArm (std::vector > (), locus); } std::string as_string () const; -- cgit v1.1