Allow only one return statement
This commit is contained in:
16
boot/ast.cc
16
boot/ast.cc
@ -795,7 +795,7 @@ namespace elna::boot
|
||||
}
|
||||
|
||||
return_statement::return_statement(const struct position position, expression *return_expression)
|
||||
: node(position), return_expression(return_expression)
|
||||
: node(position), m_return_expression(return_expression)
|
||||
{
|
||||
}
|
||||
|
||||
@ -804,9 +804,14 @@ namespace elna::boot
|
||||
visitor->visit(this);
|
||||
}
|
||||
|
||||
expression& return_statement::return_expression()
|
||||
{
|
||||
return *m_return_expression;
|
||||
}
|
||||
|
||||
return_statement::~return_statement()
|
||||
{
|
||||
delete this->return_expression;
|
||||
delete m_return_expression;
|
||||
}
|
||||
|
||||
case_statement::case_statement(const struct position position,
|
||||
@ -914,13 +919,6 @@ namespace elna::boot
|
||||
{
|
||||
}
|
||||
|
||||
while_statement::while_statement(const struct position position, conditional_statements *body,
|
||||
std::vector<conditional_statements *>&& branches, const std::string& label,
|
||||
std::vector<statement *> *alternative)
|
||||
: node(position), m_body(body), branches(std::move(branches)), label(label), alternative(alternative)
|
||||
{
|
||||
}
|
||||
|
||||
void while_statement::accept(parser_visitor *visitor)
|
||||
{
|
||||
visitor->visit(this);
|
||||
|
Reference in New Issue
Block a user