compiler/cpp/src/generate/t_go_generator.cc
/**
 * Converts the parse type to a go tyoe
 */
Converts the parse type to a go tyoe
Converts the parse type to a go tyoe
bool t_go_generator::can_be_nil(t_type* type) {
  type = get_true_type(type);
  if (type->is_base_type()) {
    t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
    switch (tbase) {
    case t_base_type::TYPE_VOID:
      throw "Invalid Type for can_be_nil";
    case t_base_type::TYPE_STRING:
    case t_base_type::TYPE_BOOL:
    case t_base_type::TYPE_BYTE:
    case t_base_type::TYPE_I16:
    case t_base_type::TYPE_I32:
    case t_base_type::TYPE_I64:
    case t_base_type::TYPE_DOUBLE:
      return false;
    }
  } else if (type->is_enum()) {
    return false;
  } else if (type->is_struct() || type->is_xception()) {
    return true;
  } else if (type->is_map()) {
    return true;
  } else if (type->is_set()) {
    return true;
  } else if (type->is_list()) {
    return true;
  }
  throw "INVALID TYPE IN can_be_nil: " + type->get_name();
}
bool t_go_generator :: can_be_nil ( t_type * type ) { type = get_true_type ( type ) ; if ( type -> is_base_type ( ) ) { t_base_type :: t_base tbase = ( ( t_base_type * ) type ) -> get_base ( ) ; switch ( tbase ) { case t_base_type :: TYPE_VOID : throw " " ; case t_base_type :: TYPE_STRING : case t_base_type :: TYPE_BOOL : case t_base_type :: TYPE_BYTE : case t_base_type :: TYPE_I16 : case t_base_type :: TYPE_I32 : case t_base_type :: TYPE_I64 : case t_base_type :: TYPE_DOUBLE : return false ; } } else if ( type -> is_enum ( ) ) { return false ; } else if ( type -> is_struct ( ) || type -> is_xception ( ) ) { return true ; } else if ( type -> is_map ( ) ) { return true ; } else if ( type -> is_set ( ) ) { return true ; } else if ( type -> is_list ( ) ) { return true ; } throw " " + type -> get_name ( ) ; }
Converts the parse type to a go tyoe
Converts the parse type to a go tyoe