1 #ifndef STAN_LANG_AST_FUN_RETURNS_TYPE_VIS_DEF_HPP 2 #define STAN_LANG_AST_FUN_RETURNS_TYPE_VIS_DEF_HPP 22 std::ostream& error_msgs)
23 : return_type_(return_type), error_msgs_(error_msgs) { }
26 error_msgs_ <<
"Expecting return, found nil statement." 32 error_msgs_ <<
"Expecting return, found assignment statement." 38 error_msgs_ <<
"Expecting return, found assignment statement." 44 error_msgs_ <<
"Expecting return, found sampling statement." 51 error_msgs_ <<
"Expecting return, found increment_log_prob statement." 57 error_msgs_ <<
"Expecting return, found increment_log_prob statement." 63 error_msgs_ <<
"Expecting return, found print statement." 69 error_msgs_ <<
"Expecting return, found reject statement." 75 error_msgs_ <<
"Expecting return, found no_op statement." 84 " statement sequence with empty body.")
107 <<
" does not match return type";
114 error_msgs_ << (
"Expecting return, found conditional" 115 " without final else.")
119 for (
size_t i = 0; i < st.
bodies_.size(); ++i)
129 "Returned expression does not match return type",
AST node for print statements.
std::string generate_
Text to generate, "break" or "continue".
Holder for local variable declarations and a sequence of statements.
AST node for assignment to variable with multi-indexing.
std::vector< statement > statements_
Sequence of statements.
bool operator()(const nil &st) const
Return true if the specified statement is a return statement with an expression of the type specified...
AST node for the increment log prob (deprecated) and target increment statements. ...
Probability, optimization and sampling library.
AST node for the reject statement.
AST structure for break and continue statements.
std::vector< statement > bodies_
The sequence of bodies to execute.
bool is_assignable(const expr_type &l_type, const expr_type &r_type, const std::string &failure_message, std::ostream &error_msgs)
Return true if an expression of the right-hand side type is assignable to a variable of the left-hand...
Structure of the type of an expression, which consists of a base type and a number of dimensions...
AST node for sampling statements.
expr_type expression_type() const
bool returns_type(const expr_type &return_type, const statement &statement, std::ostream &error_msgs)
Return true if the specified statement is a return statement returning an expression of the specified...
const int VOID_T
Void type.
expression return_value_
The value returned.
expr_type return_type_
The type of the returned expression expected.
std::vector< expression > conditions_
The sequence of conditions (parallel with bodies).
statement statement_
The body of the for loop.
AST node for representing while statements.
AST node for the no-operation statement.
AST node for the return statement.
returns_type_vis(const expr_type &return_type, std::ostream &error_msgs)
Construct visitor expecting a return statement with an expression of the specified type...
statement body_
The loop body.
The nil structure used as a placeholder for undefined or empty values in several structures.
AST node for representing a for statement.
AST node for conditional statements.
std::ostream & error_msgs_
Stream to which error messages are written.
AST node for assignment statements.