diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-12-16 10:50:24 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-12-16 11:40:11 +0000 |
commit | 3a8c585300517fe5bd95bb0dc29520871183193b (patch) | |
tree | b48048939d3da4a1b32bd41831e3eb44ca08cb88 /gcc | |
parent | 83a984b1a12694d8e06eb139089429b61e236fdd (diff) | |
download | gcc-3a8c585300517fe5bd95bb0dc29520871183193b.zip gcc-3a8c585300517fe5bd95bb0dc29520871183193b.tar.gz gcc-3a8c585300517fe5bd95bb0dc29520871183193b.tar.bz2 |
HIR::IdentifierPattern had all fields public
This makes the fields private again and adds the missing getter for the
identifier.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/backend/rust-compile-fnparam.h | 6 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-var-decl.h | 2 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir-pattern.h | 7 |
3 files changed, 6 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile-fnparam.h b/gcc/rust/backend/rust-compile-fnparam.h index 126b49f..92a7357 100644 --- a/gcc/rust/backend/rust-compile-fnparam.h +++ b/gcc/rust/backend/rust-compile-fnparam.h @@ -48,10 +48,8 @@ public: address_taken_context->lookup_addess_taken ( param.get_mappings ().get_hirid (), &address_taken); - compiled_param - = ctx->get_backend ()->parameter_variable (fndecl, pattern.variable_ident, - decl_type, address_taken, - locus); + compiled_param = ctx->get_backend ()->parameter_variable ( + fndecl, pattern.get_identifier (), decl_type, address_taken, locus); } private: diff --git a/gcc/rust/backend/rust-compile-var-decl.h b/gcc/rust/backend/rust-compile-var-decl.h index 097f5b8..a5c736d 100644 --- a/gcc/rust/backend/rust-compile-var-decl.h +++ b/gcc/rust/backend/rust-compile-var-decl.h @@ -59,7 +59,7 @@ public: translated_type = ctx->get_backend ()->immutable_type (translated_type); compiled_variable - = ctx->get_backend ()->local_variable (fndecl, pattern.variable_ident, + = ctx->get_backend ()->local_variable (fndecl, pattern.get_identifier (), translated_type, NULL /*decl_var*/, address_taken, locus); } diff --git a/gcc/rust/hir/tree/rust-hir-pattern.h b/gcc/rust/hir/tree/rust-hir-pattern.h index 1373cc7..bdeeaed 100644 --- a/gcc/rust/hir/tree/rust-hir-pattern.h +++ b/gcc/rust/hir/tree/rust-hir-pattern.h @@ -68,16 +68,13 @@ protected: // Identifier pattern HIR node (bind value matched to a variable) class IdentifierPattern : public Pattern { -public: Identifier variable_ident; bool is_ref; Mutability mut; - - // bool has_pattern; std::unique_ptr<Pattern> to_bind; - Location locus; +public: std::string as_string () const override; // Returns whether the IdentifierPattern has a pattern to bind. @@ -126,6 +123,8 @@ public: void accept_vis (HIRVisitor &vis) override; + Identifier get_identifier () const { return variable_ident; } + protected: /* Use covariance to implement clone function as returning this object rather * than base */ |