t_type* type,
t_const_value* value,
bool containerize_it) {
+ type = get_true_type(type);
std::ostringstream render;
if (type->is_base_type()) {
* validate_types method in main.cc
*/
void t_cpp_generator::print_const_value(ofstream& out, string name, t_type* type, t_const_value* value) {
+ type = get_true_type(type);
if (type->is_base_type()) {
string v2 = render_const_value(out, name, type, value);
indent(out) << name << " = " << v2 << ";" << endl <<
indent(out) << name << ".insert(" << val << ");" << endl;
}
out << endl;
+ } else {
+ throw "INVALID TYPE IN print_const_value: " + type->get_name();
}
}
//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) {
+ type = get_true_type(type);
indent(out);
bool need_static_construction = !in_static;
if (!defval || needtype) {
out << name << " = new " << type_name(type, true, true) << "();" << endl;
} else if (type->is_list() || type->is_set()) {
out << name << " = new " << type_name(type) << "();" << endl;
+ } else {
+ throw "compiler error: no const of type " + type->get_name();
}
if (defval && !type->is_base_type() && !type->is_enum()) {
* validate_types method in main.cc
*/
string t_erl_generator::render_const_value(t_type* type, t_const_value* value) {
+ type = get_true_type(type);
std::ostringstream out;
if (type->is_base_type()) {
out << render_const_value(etype, *v_iter);
}
out << "]";
+ } else {
+ throw "CANNOT GENERATE CONSTANT FOR TYPE: " + type->get_name();
}
return out.str();
}
* validate_types method in main.cc
*/
string t_hs_generator::render_const_value(t_type* type, t_const_value* value) {
+ type = get_true_type(type);
std::ostringstream out;
if (type->is_base_type()) {
t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
out << val;
}
out << "])";
+ } else {
+ throw "CANNOT GENERATE CONSTANT FOR TYPE: " + type->get_name();
}
return out.str();
}
* validate_types method in main.cc
*/
void t_java_generator::print_const_value(std::ofstream& out, string name, t_type* type, t_const_value* value, bool in_static, bool defval) {
+ type = get_true_type(type);
indent(out);
if (!defval) {
indent(out) << "}" << endl;
}
out << endl;
+ } else {
+ throw "compiler error: no const of type " + type->get_name();
}
}
string t_java_generator::render_const_value(ofstream& out, string name, t_type* type, t_const_value* value) {
+ type = get_true_type(type);
std::ostringstream render;
if (type->is_base_type()) {
* validate_types method in main.cc
*/
string t_ocaml_generator::render_const_value(t_type* type, t_const_value* value) {
+ type = get_true_type(type);
std::ostringstream out;
if (type->is_base_type()) {
t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
indent(out) << hm << ")" << endl;
indent_down();
out << endl;
+ } else {
+ throw "CANNOT GENERATE CONSTANT FOR TYPE: " + type->get_name();
}
return out.str();
}
* validate_types method in main.cc
*/
string t_py_generator::render_const_value(t_type* type, t_const_value* value) {
+ type = get_true_type(type);
std::ostringstream out;
if (type->is_base_type()) {
if (type->is_set()) {
out << ")";
}
+ } else {
+ throw "CANNOT GENERATE CONSTANT FOR TYPE: " + type->get_name();
}
return out.str();
* validate_types method in main.cc
*/
string t_rb_generator::render_const_value(t_type* type, t_const_value* value) {
+ type = get_true_type(type);
std::ostringstream out;
if (type->is_base_type()) {
t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
} else {
indent(out) << "]";
}
+ } else {
+ throw "CANNOT GENERATE CONSTANT FOR TYPE: " + type->get_name();
}
return out.str();
}
* validate_types method in main.cc
*/
string t_st_generator::render_const_value(t_type* type, t_const_value* value) {
+ type = get_true_type(type);
std::ostringstream out;
if (type->is_base_type()) {
t_base_type::t_base tbase = ((t_base_type*)type)->get_base();
out << indent() << indent() << "yourself)";
indent_down();
indent_down();
+ } else {
+ throw "CANNOT GENERATE CONSTANT FOR TYPE: " + type->get_name();
}
return out.str();
}
1: constants val = TWO
}
+typedef i32 myIntType
+const myIntType myInt = 3
+
const map<constants,string> GEN_ENUM_NAMES = {ONE : "HOWDY", TWO: PARTNER}
const i32 hex_const = 0x0001F