diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-02-17 15:03:28 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-02-18 09:08:07 +0100 |
commit | 205a9cbf9e2c2940e6715fa69be89765af582d29 (patch) | |
tree | 1351e475f58a84af20be46420870bebab2cf2ca9 /gcc | |
parent | 9fb06d66cef70584e7aa2fa3a6ad22ef7def6b84 (diff) | |
download | gcc-205a9cbf9e2c2940e6715fa69be89765af582d29.zip gcc-205a9cbf9e2c2940e6715fa69be89765af582d29.tar.gz gcc-205a9cbf9e2c2940e6715fa69be89765af582d29.tar.bz2 |
fn-arg: Add location on parameter name
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/ast/rust-item.h | 9 | ||||
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 3 |
2 files changed, 6 insertions, 6 deletions
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h index b04aa05..94e5cbd 100644 --- a/gcc/rust/ast/rust-item.h +++ b/gcc/rust/ast/rust-item.h @@ -3941,12 +3941,11 @@ private: std::unique_ptr<Type> param_type; - // TODO: should this store location data? - // seemingly new since writing this node std::vector<Attribute> outer_attrs; NodeId node_id; + Location locus; public: /* Returns whether the named function parameter has a name (i.e. name is not @@ -3967,14 +3966,14 @@ public: // Creates an error state named function parameter. static NamedFunctionParam create_error () { - return NamedFunctionParam ("", nullptr, {}); + return NamedFunctionParam ("", nullptr, {}, Location ()); } NamedFunctionParam (std::string name, std::unique_ptr<Type> param_type, - std::vector<Attribute> outer_attrs) + std::vector<Attribute> outer_attrs, Location locus) : name (std::move (name)), param_type (std::move (param_type)), outer_attrs (std::move (outer_attrs)), - node_id (Analysis::Mappings::get ()->get_next_node_id ()) + node_id (Analysis::Mappings::get ()->get_next_node_id ()), locus (locus) {} // Copy constructor diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 784e6d1..3d1f58b 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -5993,6 +5993,7 @@ Parser<ManagedTokenSource>::parse_named_function_param ( std::string name; const_TokenPtr t = lexer.peek_token (); + Location name_location = t->get_locus (); switch (t->get_id ()) { case IDENTIFIER: @@ -6028,7 +6029,7 @@ Parser<ManagedTokenSource>::parse_named_function_param ( } return AST::NamedFunctionParam (std::move (name), std::move (param_type), - std::move (outer_attrs)); + std::move (outer_attrs), name_location); } // Parses a statement (will further disambiguate any statement). |