Add an else to the case statement
This commit is contained in:
13
boot/ast.cc
13
boot/ast.cc
@ -794,8 +794,8 @@ namespace elna::boot
|
||||
}
|
||||
|
||||
case_statement::case_statement(const struct position position,
|
||||
expression *condition, std::vector<switch_case>&& cases)
|
||||
: node(position), m_condition(condition), cases(std::move(cases))
|
||||
expression *condition, std::vector<switch_case>&& cases, std::vector<statement *> *alternative)
|
||||
: node(position), m_condition(condition), cases(std::move(cases)), alternative(alternative)
|
||||
{
|
||||
}
|
||||
|
||||
@ -862,7 +862,7 @@ namespace elna::boot
|
||||
|
||||
if_statement::if_statement(const struct position position, conditional_statements *body,
|
||||
std::vector<statement *> *alternative)
|
||||
: node(position), m_body(body), m_alternative(alternative)
|
||||
: node(position), m_body(body), alternative(alternative)
|
||||
{
|
||||
}
|
||||
|
||||
@ -881,11 +881,6 @@ namespace elna::boot
|
||||
return *m_body;
|
||||
}
|
||||
|
||||
std::vector<statement *> *if_statement::alternative()
|
||||
{
|
||||
return m_alternative;
|
||||
}
|
||||
|
||||
if_statement::~if_statement()
|
||||
{
|
||||
delete m_body;
|
||||
@ -893,7 +888,7 @@ namespace elna::boot
|
||||
{
|
||||
delete branch;
|
||||
}
|
||||
delete m_alternative;
|
||||
delete this->alternative;
|
||||
}
|
||||
|
||||
while_statement::while_statement(const struct position position, conditional_statements *body)
|
||||
|
Reference in New Issue
Block a user