Expr* admit_call_expr(Context& cxt, Usage& c, Call_expr& e) { Call_expr& a = cast<Call_expr>(c.expression()); // Build the list of parameter types from the declared types // of operands in the constraint. Type_list ts {&declared_type(a.function())}; for (Expr& e0 : a.arguments()) ts.push_back(declared_type(e0)); // Build the list of arguments from e. Note that the first // argument is actually the function. Expr_list es {&e.function()}; for (Expr& e0 : e.arguments()) es.push_back(e0); // If conversion fails, this is not accessible. try { initialize_parameters(cxt, ts, es); } catch (Translation_error&) { return nullptr; } // Adjust the type and admit the expression. e.type_ = &a.type(); return &e; }
// Parse a comma-separated list of expressions. // // expression-list; // expression // expression-list ',' expression Expr_list Parser::expression_list() { Expr_list es; do { Expr& e = expression(); es.push_back(e); } while (match_if(tk::comma_tok)); return es; }
Expr_list* Transform::transform_expr_list(Expr_list* in) { Expr_list::const_iterator i; Expr_list* out = new Expr_list; if(in == NULL) return NULL; for(i = in->begin(); i != in->end(); i++) { out->push_back(transform_expr(*i)); } return out; }
// Returns true if any expression in the list is type dependent. bool is_type_dependent(Expr_list const& es) { auto p = [](Expr const& e) { return is_type_dependent(e); }; return std::any_of(es.begin(), es.end(), p); }