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/ast/rust-expr.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'gcc/rust/ast') diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index 2f46fee..3f3ed5c 100644 --- a/gcc/rust/ast/rust-expr.h +++ b/gcc/rust/ast/rust-expr.h @@ -4225,7 +4225,6 @@ private: // inlined from MatchArmGuard std::unique_ptr guard_expr; - // TODO: should this store location data? Location locus; public: @@ -4234,9 +4233,8 @@ public: // Constructor for match arm with a guard expression MatchArm (std::vector > match_arm_patterns, - std::unique_ptr guard_expr = nullptr, - std::vector outer_attrs = std::vector (), - Location locus = Location ()) + Location locus, std::unique_ptr guard_expr = nullptr, + std::vector outer_attrs = std::vector ()) : outer_attrs (std::move (outer_attrs)), match_arm_patterns (std::move (match_arm_patterns)), guard_expr (std::move (guard_expr)), locus (locus) @@ -4285,7 +4283,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