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& op) { if (!RenderExpr(c, *op.op0())) return false; if (!RenderExpr(c, *op.op1())) return false; if (!RenderExpr(c, *op.op2())) return false; if (!RenderIndent(c)) return false; MAP_AST_EXPR(c, op); const char* opStr; switch (op.expr()) { case Expr::Select: opStr = "select"; break; default: return Fail(c, "unexpected ternary operator"); } return c.buffer.append(opStr, strlen(opStr)); }