예제 #1
0
파일: matchtype.c 프로젝트: aturley/ponyc
static matchtype_t is_nominal_match_trait(ast_t* operand, ast_t* pattern,
  errorframe_t* errorf, bool report_reject, pass_opt_t* opt)
{
  ast_t* operand_def = (ast_t*)ast_data(operand);

  switch(ast_id(operand_def))
  {
    case TK_PRIMITIVE:
    case TK_STRUCT:
    case TK_CLASS:
    case TK_ACTOR:
      return is_entity_match_trait(operand, pattern, errorf, report_reject,
        opt);

    case TK_TRAIT:
    case TK_INTERFACE:
      return is_trait_match_trait(operand, pattern, errorf, report_reject,
        opt);

    default: {}
  }

  pony_assert(0);
  return MATCHTYPE_DENY;
}
예제 #2
0
파일: matchtype.c 프로젝트: mgist/ponyc
static matchtype_t is_nominal_match_trait(ast_t* operand, ast_t* pattern)
{
  ast_t* operand_def = (ast_t*)ast_data(operand);

  switch(ast_id(operand_def))
  {
    case TK_PRIMITIVE:
    case TK_STRUCT:
    case TK_CLASS:
    case TK_ACTOR:
      return is_entity_match_trait(operand, pattern);

    case TK_TRAIT:
    case TK_INTERFACE:
      return is_trait_match_trait(operand, pattern);

    default: {}
  }

  assert(0);
  return MATCHTYPE_DENY;
}