diff options
author | SimplyTheOther <simplytheother@gmail.com> | 2020-12-18 21:33:09 +0800 |
---|---|---|
committer | SimplyTheOther <simplytheother@gmail.com> | 2020-12-18 21:33:09 +0800 |
commit | aa283484a3dffedc404653af18f9413775cbc3df (patch) | |
tree | 118a5b918c48fba3261731bba0a6b4149209f7d8 /gcc/rust/ast/rust-pattern.h | |
parent | f764eeb8abf1ec50794ddb1f31bc57d025e29a3c (diff) | |
parent | bc14d9a0cd3c67093a9c11ad368c0d28325b21c6 (diff) | |
download | gcc-aa283484a3dffedc404653af18f9413775cbc3df.zip gcc-aa283484a3dffedc404653af18f9413775cbc3df.tar.gz gcc-aa283484a3dffedc404653af18f9413775cbc3df.tar.bz2 |
Merge branch 'master' of https://github.com/redbrain/gccrs
Diffstat (limited to 'gcc/rust/ast/rust-pattern.h')
-rw-r--r-- | gcc/rust/ast/rust-pattern.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h index 3a87a83..dc4d48c 100644 --- a/gcc/rust/ast/rust-pattern.h +++ b/gcc/rust/ast/rust-pattern.h @@ -69,8 +69,8 @@ public: IdentifierPattern (Identifier ident, Location locus, bool is_ref = false, bool is_mut = false, std::unique_ptr<Pattern> to_bind = nullptr) - : variable_ident (std::move (ident)), is_ref (is_ref), is_mut (is_mut), - to_bind (std::move (to_bind)), locus (locus) + : Pattern (), variable_ident (std::move (ident)), is_ref (is_ref), + is_mut (is_mut), to_bind (std::move (to_bind)), locus (locus) {} // Copy constructor with clone @@ -78,7 +78,9 @@ public: : variable_ident (other.variable_ident), is_ref (other.is_ref), is_mut (other.is_mut), locus (other.locus) { - // fix to prevent null pointer dereference + node_id = other.node_id; + // fix to get prevent null pointer dereference + if (other.to_bind != nullptr) to_bind = other.to_bind->clone_pattern (); } @@ -90,6 +92,7 @@ public: is_ref = other.is_ref; is_mut = other.is_mut; locus = other.locus; + node_id = other.node_id; // fix to prevent null pointer dereference if (other.to_bind != nullptr) @@ -118,6 +121,9 @@ public: Identifier get_ident () const { return variable_ident; } + bool get_is_mut () const { return is_mut; } + bool get_is_ref () const { return is_ref; } + protected: /* Use covariance to implement clone function as returning this object rather * than base */ |