static bool RenderTernaryOperator(WasmRenderContext& c, AstTernaryOperator& op) { if (!c.buffer.append("(")) return false; const char* opStr; switch (op.expr()) { case Expr::Select: opStr = "select"; break; default: return false; } if (!c.buffer.append(opStr, strlen(opStr))) return false; if (!c.buffer.append(" ")) return false; if (!RenderExpr(c, *op.op0())) return false; if (!c.buffer.append(" ")) return false; if (!RenderExpr(c, *op.op1())) return false; if (!c.buffer.append(" ")) return false; if (!RenderExpr(c, *op.op2())) return false; if (!c.buffer.append(")")) return false; return true; }
static bool RenderTernaryOperator(WasmRenderContext& c, AstTernaryOperator& ternary) { if (!RenderExpr(c, *ternary.op0())) return false; if (!RenderExpr(c, *ternary.op1())) return false; if (!RenderExpr(c, *ternary.op2())) return false; if (!RenderIndent(c)) return false; MAP_AST_EXPR(c, ternary); const char* opStr; switch (ternary.op()) { case Op::Select: opStr = "select"; break; default: return Fail(c, "unexpected ternary operator"); } return c.buffer.append(opStr, strlen(opStr)); }