diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/ast/rust-expr.h | 8 | ||||
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index bacf1cd..7994aed 100644 --- a/gcc/rust/ast/rust-expr.h +++ b/gcc/rust/ast/rust-expr.h @@ -1514,11 +1514,11 @@ struct StructBase { private: std::unique_ptr<Expr> base_struct; + Location locus; public: - // TODO: should this store location data? - StructBase (std::unique_ptr<Expr> base_struct_ptr) - : base_struct (std::move (base_struct_ptr)) + StructBase (std::unique_ptr<Expr> base_struct_ptr, Location locus) + : base_struct (std::move (base_struct_ptr)), locus (locus) {} // Copy constructor requires clone @@ -1550,7 +1550,7 @@ public: StructBase &operator= (StructBase &&other) = default; // Returns a null expr-ed StructBase - error state - static StructBase error () { return StructBase (nullptr); } + static StructBase error () { return StructBase (nullptr, Location ()); } // Returns whether StructBase is in error state bool is_invalid () const { return base_struct == nullptr; } diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 8703ecb..445acad 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -14441,6 +14441,7 @@ Parser<ManagedTokenSource>::parse_struct_expr_struct_partial ( AST::StructBase struct_base = AST::StructBase::error (); if (lexer.peek_token ()->get_id () == DOT_DOT) { + Location dot_dot_location = lexer.peek_token ()->get_locus (); lexer.skip_token (); // parse required struct base expr @@ -14458,7 +14459,8 @@ Parser<ManagedTokenSource>::parse_struct_expr_struct_partial ( // DEBUG: rust_debug ("struct/enum expr - parsed and validated base expr"); - struct_base = AST::StructBase (std::move (base_expr)); + struct_base + = AST::StructBase (std::move (base_expr), dot_dot_location); // DEBUG: rust_debug ("assigned struct base to new struct base "); |