コード例 #1
0
ファイル: gendesc.c プロジェクト: npruehs/ponyc
LLVMValueRef gendesc_isnominal(compile_t* c, LLVMValueRef desc, ast_t* type)
{
  ast_t* def = (ast_t*)ast_data(type);

  switch(ast_id(def))
  {
    case TK_STRUCT:
      // The type system has ensured that at this stage the operand must be
      // the pattern type.
      return LLVMConstInt(c->i1, 1, false);

    case TK_INTERFACE:
    case TK_TRAIT:
      return gendesc_istrait(c, desc, type);

    case TK_PRIMITIVE:
    case TK_CLASS:
    case TK_ACTOR:
      return gendesc_isentity(c, desc, type);

    default: {}
  }

  assert(0);
  return GEN_NOVALUE;
}
コード例 #2
0
ファイル: gendesc.c プロジェクト: awaidmann/ponyc
LLVMValueRef gendesc_isnominal(compile_t* c, LLVMValueRef desc, ast_t* type)
{
  ast_t* def = (ast_t*)ast_data(type);

  switch(ast_id(def))
  {
    case TK_INTERFACE:
    case TK_TRAIT:
      return gendesc_istrait(c, desc, type);

    case TK_PRIMITIVE:
    case TK_CLASS:
    case TK_ACTOR:
      return gendesc_isentity(c, desc, type);

    default: {}
  }

  assert(0);
  return GEN_NOVALUE;
}