Пример #1
0
static matchtype_t is_x_match_nominal(ast_t* operand, ast_t* pattern,
  pass_opt_t* opt)
{
  switch(ast_id(operand))
  {
    case TK_UNIONTYPE:
      return is_union_match_x(operand, pattern, opt);

    case TK_ISECTTYPE:
      return is_isect_match_x(operand, pattern, opt);

    case TK_TUPLETYPE:
      return MATCHTYPE_REJECT;

    case TK_NOMINAL:
      return is_nominal_match_nominal(operand, pattern, opt);

    case TK_TYPEPARAMREF:
      return is_typeparam_match_x(operand, pattern, opt);

    case TK_ARROW:
      return is_arrow_match_x(operand, pattern, opt);

    default: {}
  }

  assert(0);
  return MATCHTYPE_DENY;
}
Пример #2
0
static matchtype_t is_x_match_nominal(ast_t* operand, ast_t* pattern,
  errorframe_t* errorf, bool report_reject, pass_opt_t* opt)
{
  switch(ast_id(operand))
  {
    case TK_UNIONTYPE:
      return is_union_match_x(operand, pattern, errorf, report_reject, opt);

    case TK_ISECTTYPE:
      return is_isect_match_x(operand, pattern, errorf, report_reject, opt);

    case TK_TUPLETYPE:
      return is_tuple_match_nominal(operand, pattern, errorf, report_reject,
        opt);

    case TK_NOMINAL:
      return is_nominal_match_nominal(operand, pattern, errorf, report_reject,
        opt);

    case TK_TYPEPARAMREF:
      return is_typeparam_match_x(operand, pattern, errorf, report_reject, opt);

    case TK_ARROW:
      return is_arrow_match_x(operand, pattern, errorf, report_reject, opt);

    case TK_FUNTYPE:
      return MATCHTYPE_REJECT;

    default: {}
  }

  pony_assert(0);
  return MATCHTYPE_DENY;
}