diff options
Diffstat (limited to 'gcc/rust/ast/rust-item.h')
-rw-r--r-- | gcc/rust/ast/rust-item.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h index 1088842..9bd8de4 100644 --- a/gcc/rust/ast/rust-item.h +++ b/gcc/rust/ast/rust-item.h @@ -1746,6 +1746,8 @@ public: return where_clause; } + Identifier get_identifier () const { return struct_name; } + protected: Struct (Identifier struct_name, std::vector<std::unique_ptr<GenericParam> > generic_params, @@ -1802,6 +1804,8 @@ private: // should this store location info? + NodeId node_id; + public: // Returns whether struct field has any outer attributes. bool has_outer_attributes () const { return !outer_attrs.empty (); } @@ -1877,6 +1881,8 @@ public: } Visibility get_visibility () const { return visibility; } + + NodeId get_node_id () const { return node_id; } }; // Rust struct declaration with true struct type AST node @@ -1922,6 +1928,15 @@ public: std::vector<StructField> &get_fields () { return fields; } const std::vector<StructField> &get_fields () const { return fields; } + void iterate (std::function<bool (StructField &)> cb) + { + for (auto &field : fields) + { + if (!cb (field)) + return; + } + } + protected: /* Use covariance to implement clone function as returning this object * rather than base */ |