Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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;
}