compiler/cpp/src/generate/t_csharp_generator.cc
//it seems like all that methods that call this are using in_static to be the opposite of what it would imply
it seems like all that methods that call this are using in_static to be the opposite of what it would imply
it seems like all that methods that call this are using in_static to be the opposite of what it would imply
bool t_csharp_generator::print_const_value(std::ofstream& out, string name, t_type* type, t_const_value* value, bool in_static, bool defval, bool needtype) {
  indent(out);
  bool need_static_construction = !in_static;
  while (type->is_typedef()) {
    type = ((t_typedef*)type)->get_type();
  }
  if (!defval || needtype) {
    out <<
      (in_static ? "" : "public static ") <<
      type_name(type) << " ";
  }
  if (type->is_base_type()) {
    string v2 = render_const_value(out, name, type, value);
    out << name << " = " << v2 << ";" << endl;
    need_static_construction = false;
  } else if (type->is_enum()) {
    out << name << " = " << type_name(type, false, true) << "." << value->get_identifier_name() << ";" << endl;
    need_static_construction = false;
  } else if (type->is_struct() || type->is_xception()) {
    out << name << " = new " << type_name(type) << "();" << endl;
  } else if (type->is_map()) {
    out << name << " = new " << type_name(type, true, true) << "();" << endl;
  } else if (type->is_list() || type->is_set()) {
    out << name << " = new " << type_name(type) << "();" << endl;
  }
  if (defval && !type->is_base_type() && !type->is_enum()) {
    print_const_def_value(out, name, type, value);
  }
  return need_static_construction;
}
bool t_csharp_generator :: print_const_value ( std :: ofstream & out , string name , t_type * type , t_const_value * value , bool in_static , bool defval , bool needtype ) { indent ( out ) ; bool need_static_construction = ! in_static ; while ( type -> is_typedef ( ) ) { type = ( ( t_typedef * ) type ) -> get_type ( ) ; } if ( ! defval || needtype ) { out << ( in_static ? " " : " " ) << type_name ( type ) << " " ; } if ( type -> is_base_type ( ) ) { string v2 = render_const_value ( out , name , type , value ) ; out << name << " " << v2 << " " << endl ; need_static_construction = false ; } else if ( type -> is_enum ( ) ) { out << name << " " << type_name ( type , false , true ) << " " << value -> get_identifier_name ( ) << " " << endl ; need_static_construction = false ; } else if ( type -> is_struct ( ) || type -> is_xception ( ) ) { out << name << " " << type_name ( type ) << " " << endl ; } else if ( type -> is_map ( ) ) { out << name << " " << type_name ( type , true , true ) << " " << endl ; } else if ( type -> is_list ( ) || type -> is_set ( ) ) { out << name << " " << type_name ( type ) << " " << endl ; } if ( defval && ! type -> is_base_type ( ) && ! type -> is_enum ( ) ) { print_const_def_value ( out , name , type , value ) ; } return need_static_construction ; }
it seems like all that methods that call this are using in_static to be the opposite of what it would imply
it seems like all that methods that call this are using in_static to be the opposite of what it would imply