diff options
author | David Faust <david.faust@oracle.com> | 2022-07-06 12:21:03 -0700 |
---|---|---|
committer | David Faust <david.faust@oracle.com> | 2022-07-06 12:21:03 -0700 |
commit | fe64842ff930e552917272319de55f9a1e4cd2fa (patch) | |
tree | 0f7cb141958ead3207545965e3b3052752345f1c | |
parent | 29d594e263f0ccbcbd2babf43ff453c5188f4f2c (diff) | |
download | gcc-fe64842ff930e552917272319de55f9a1e4cd2fa.zip gcc-fe64842ff930e552917272319de55f9a1e4cd2fa.tar.gz gcc-fe64842ff930e552917272319de55f9a1e4cd2fa.tar.bz2 |
HIR: add Literal is_equal ()
A small helper for checking when two Literals contain the same value.
-rw-r--r-- | gcc/rust/hir/tree/rust-hir.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/rust/hir/tree/rust-hir.h b/gcc/rust/hir/tree/rust-hir.h index 8f94354..ff4c39e 100644 --- a/gcc/rust/hir/tree/rust-hir.h +++ b/gcc/rust/hir/tree/rust-hir.h @@ -122,6 +122,12 @@ public: // Returns whether literal is in an invalid state. bool is_error () const { return value_as_string == ""; } + + bool is_equal (Literal &other) + { + return value_as_string == other.value_as_string && type == other.type + && type_hint == other.type_hint; + } }; /* Base statement abstract class. Note that most "statements" are not allowed in |