diff options
author | SimplyTheOther <simplytheother@gmail.com> | 2020-12-09 15:29:51 +0800 |
---|---|---|
committer | SimplyTheOther <simplytheother@gmail.com> | 2020-12-09 15:29:51 +0800 |
commit | 41c14b45ac604ebd69a6715445cdb10fc5c5ec07 (patch) | |
tree | fb9e6c7e60b9024b1857c0fcf6241c118f2f67f4 /gcc/rust/ast/rust-expr.h | |
parent | 815c9e8b0734d45a6e5b5a7d50f38d4af7120a8c (diff) | |
parent | cef34bd730d80b4664d8633e2cc27a64c5cae246 (diff) | |
download | gcc-41c14b45ac604ebd69a6715445cdb10fc5c5ec07.zip gcc-41c14b45ac604ebd69a6715445cdb10fc5c5ec07.tar.gz gcc-41c14b45ac604ebd69a6715445cdb10fc5c5ec07.tar.bz2 |
Merge branch 'master' of https://github.com/redbrain/gccrs
Diffstat (limited to 'gcc/rust/ast/rust-expr.h')
-rw-r--r-- | gcc/rust/ast/rust-expr.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index 34dfc25..c7302fe 100644 --- a/gcc/rust/ast/rust-expr.h +++ b/gcc/rust/ast/rust-expr.h @@ -972,6 +972,17 @@ public: const std::vector<std::unique_ptr<Expr> > &get_values () const { return values; } std::vector<std::unique_ptr<Expr> > &get_values () { return values; } + size_t get_num_values () const { return values.size (); } + + void iterate (std::function<bool (Expr *)> cb) + { + for (auto it = values.begin (); it != values.end (); it++) + { + if (!cb ((*it).get ())) + return; + } + } + protected: ArrayElemsValues *clone_array_elems_impl () const override { @@ -1048,6 +1059,10 @@ class ArrayExpr : public ExprWithoutBlock // TODO: find another way to store this to save memory? bool marked_for_strip = false; + // this is a reference to what the inferred type is based on + // this init expression + Type *inferredType; + public: std::string as_string () const override; @@ -1111,6 +1126,9 @@ public: return internal_elements; } + Type *get_inferred_type () { return inferredType; } + void set_inferred_type (Type *type) { inferredType = type; } + protected: /* Use covariance to implement clone function as returning this object rather * than base */ |