aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-expr.h
diff options
context:
space:
mode:
authorSimplyTheOther <simplytheother@gmail.com>2020-12-25 18:00:23 +0800
committerSimplyTheOther <simplytheother@gmail.com>2020-12-25 18:00:23 +0800
commitfaf78e75e4ec3c989e452d47dc37a0be1706bf08 (patch)
tree8cd4b2b11b9d7e259466fff9638c0057fcc52340 /gcc/rust/ast/rust-expr.h
parent859720937474816d4d386664d56d80a9e840f06f (diff)
parent8d34ac3c1602d8506ae4b65d92075be86f5a6c9a (diff)
downloadgcc-faf78e75e4ec3c989e452d47dc37a0be1706bf08.zip
gcc-faf78e75e4ec3c989e452d47dc37a0be1706bf08.tar.gz
gcc-faf78e75e4ec3c989e452d47dc37a0be1706bf08.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.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index 89718bc..4fb4785 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -552,6 +552,8 @@ public:
return right_expr;
}
+ ExprType get_kind () { return expr_type; }
+
/* TODO: implement via a function call to std::cmp::PartialEq::eq(&op1, &op2)
* maybe? */
protected:
@@ -630,6 +632,8 @@ public:
return right_expr;
}
+ ExprType get_kind () { return expr_type; }
+
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -950,9 +954,15 @@ public:
virtual void accept_vis (ASTVisitor &vis) = 0;
+ NodeId get_node_id () const { return node_id; }
+
protected:
+ ArrayElems () : node_id (Analysis::Mappings::get ()->get_next_node_id ()) {}
+
// pure virtual clone implementation
virtual ArrayElems *clone_array_elems_impl () const = 0;
+
+ NodeId node_id;
};
// Value array elements
@@ -964,7 +974,7 @@ class ArrayElemsValues : public ArrayElems
public:
ArrayElemsValues (std::vector<std::unique_ptr<Expr> > elems)
- : values (std::move (elems))
+ : ArrayElems (), values (std::move (elems))
{}
// copy constructor with vector clone
@@ -1030,7 +1040,7 @@ public:
// Constructor requires pointers for polymorphism
ArrayElemsCopied (std::unique_ptr<Expr> copied_elem,
std::unique_ptr<Expr> copy_amount)
- : elem_to_copy (std::move (copied_elem)),
+ : ArrayElems (), elem_to_copy (std::move (copied_elem)),
num_copies (std::move (copy_amount))
{}
@@ -1089,10 +1099,6 @@ 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;
@@ -1157,9 +1163,6 @@ 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 */