aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-item.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/ast/rust-item.h')
-rw-r--r--gcc/rust/ast/rust-item.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h
index 6de37f6..9437f21 100644
--- a/gcc/rust/ast/rust-item.h
+++ b/gcc/rust/ast/rust-item.h
@@ -698,6 +698,8 @@ class Method : public InherentImplItem, public TraitImplItem
Location locus;
+ NodeId node_id;
+
public:
// Returns whether the method is in an error state.
bool is_error () const
@@ -746,7 +748,8 @@ public:
function_params (std::move (function_params)),
return_type (std::move (return_type)),
where_clause (std::move (where_clause)),
- function_body (std::move (function_body)), locus (locus)
+ function_body (std::move (function_body)), locus (locus),
+ node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}
// TODO: add constructor with less fields
@@ -769,6 +772,8 @@ public:
generic_params.reserve (other.generic_params.size ());
for (const auto &e : other.generic_params)
generic_params.push_back (e->clone_generic_param ());
+
+ node_id = other.node_id;
}
// Overloaded assignment operator to clone
@@ -799,6 +804,8 @@ public:
for (const auto &e : other.generic_params)
generic_params.push_back (e->clone_generic_param ());
+ node_id = other.node_id;
+
return *this;
}
@@ -860,6 +867,14 @@ public:
return where_clause;
}
+ Identifier get_method_name () const { return method_name; }
+
+ NodeId get_node_id () const { return node_id; }
+
+ Location get_locus () const { return locus; }
+
+ Location get_locus_slow () const override { return get_locus (); }
+
protected:
/* Use covariance to implement clone function as returning this object
* rather than base */
@@ -1505,6 +1520,8 @@ public:
Location get_locus () const { return locus; }
+ Location get_locus_slow () const override { return get_locus (); }
+
void accept_vis (ASTVisitor &vis) override;
// Invalid if block is null, so base stripping on that.
@@ -2538,6 +2555,8 @@ public:
Location get_locus () const { return locus; }
+ Location get_locus_slow () const override { return get_locus (); }
+
void accept_vis (ASTVisitor &vis) override;
// Invalid if type or expression are null, so base stripping on that.