diff options
Diffstat (limited to 'boot/ast.cc')
| -rw-r--r-- | boot/ast.cc | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/boot/ast.cc b/boot/ast.cc index 69d72fb..a2f108a 100644 --- a/boot/ast.cc +++ b/boot/ast.cc @@ -800,6 +800,15 @@ namespace elna::boot return *this->m_value; } + void field_initializer::value(expression& value) + { + if (this->m_value != &value) + { + delete this->m_value; + this->m_value = &value; + } + } + record_constructor_expression::record_constructor_expression(const source_position position, identifier&& type_name, std::vector<field_initializer>&& field_initializers) @@ -1255,16 +1264,34 @@ namespace elna::boot return this; } - expression& binary_expression::lhs() + expression& binary_expression::lhs() const { return *m_lhs; } - expression& binary_expression::rhs() + void binary_expression::lhs(expression& lhs) + { + if (this->m_lhs != &lhs) + { + delete this->m_lhs; + this->m_lhs = &lhs; + } + } + + expression& binary_expression::rhs() const { return *m_rhs; } + void binary_expression::rhs(expression& rhs) + { + if (this->m_rhs != &rhs) + { + delete this->m_rhs; + this->m_rhs = &rhs; + } + } + binary_operator binary_expression::operation() const { return m_operator; @@ -1297,11 +1324,20 @@ namespace elna::boot return this; } - expression& unary_expression::operand() + expression& unary_expression::operand() const { return *m_operand; } + void unary_expression::operand(expression& operand) + { + if (this->m_operand != &operand) + { + delete this->m_operand; + this->m_operand = &operand; + } + } + unary_operator unary_expression::operation() const { return this->m_operator; @@ -1367,11 +1403,20 @@ namespace elna::boot return *m_target; } - expression& cast_expression::value() + expression& cast_expression::value() const { return *m_value; } + void cast_expression::value(expression& value) + { + if (this->m_value != &value) + { + delete this->m_value; + this->m_value = &value; + } + } + cast_expression::~cast_expression() { delete m_target; |
