8 #include <hilti/ast/expression.h>
9 #include <hilti/ast/type.h>
11 namespace hilti::expression {
16 auto condition()
const {
return child<Expression>(0); }
17 auto true_()
const {
return child<Expression>(1); }
18 auto false_()
const {
return child<Expression>(2); }
23 return true_()->type();
29 static auto create(ASTContext* ctx, Expression* cond, Expression* true_, Expression* false_, Meta
meta = {}) {
30 return ctx->make<Ternary>(ctx, {cond, true_, false_}, std::move(
meta));
35 : Expression(ctx, NodeTags, std::move(
children), std::move(
meta)) {}
37 HILTI_NODE_1(expression::Ternary, Expression,
final);
Definition: ast-context.h:121
Definition: expression.h:15
void setChild(ASTContext *ctx, size_t idx, Node *n)
Definition: node.h:602
const auto & children() const
Definition: node.h:364
const auto & meta() const
Definition: node.h:306
QualifiedType * type() const final
Definition: ternary.h:20