void operation_print_open_on(value_t self, value_t transport, print_on_context_t *context) { value_t value = get_operation_value(self); print_on_context_t unquote_context = *context; unquote_context.flags |= pfUnquote; bool is_async = is_same_value(transport, transport_async()); switch (get_operation_type(self)) { case otAssign: // Since the operator for the assignment is kind of sort of part of the // operator let's not decrease depth. If you make an assignment whose // operator is the assignment itself then 1) this will fail and 2) I hate // you. value_print_inner_on(value, &unquote_context, 0); string_buffer_printf(context->buf, ":=("); break; case otCall: string_buffer_printf(context->buf, "("); break; case otIndex: string_buffer_printf(context->buf, "["); break; case otInfix: string_buffer_printf(context->buf, is_async ? "->" : "."); value_print_inner_on(value, &unquote_context, -1); string_buffer_printf(context->buf, "("); break; case otPrefix: value_print_inner_on(value, &unquote_context, -1); string_buffer_printf(context->buf, "("); break; case otSuffix: string_buffer_printf(context->buf, "("); break; default: UNREACHABLE("unexpected operation type"); break; } }
void alarm_async(alarm_t a, view_state_t vs, const endpt_id_t *endpt) { transport_async(a->transport, vs, endpt) ; }