You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2017/10/10 15:47:17 UTC
thrift git commit: THRIFT-4355 Fix javascript indentation of default
values Client: js
Repository: thrift
Updated Branches:
refs/heads/master b62873686 -> 8b8a8efea
THRIFT-4355 Fix javascript indentation of default values
Client: js
This closes #1388
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/8b8a8efe
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/8b8a8efe
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/8b8a8efe
Branch: refs/heads/master
Commit: 8b8a8efea13d1c97f856053af0a5c0e6a8a76354
Parents: b628736
Author: Brian Forbis <bf...@athenahealth.com>
Authored: Sat Oct 7 19:57:40 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Tue Oct 10 08:46:46 2017 -0700
----------------------------------------------------------------------
compiler/cpp/src/thrift/generate/t_js_generator.cc | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/8b8a8efe/compiler/cpp/src/thrift/generate/t_js_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_js_generator.cc b/compiler/cpp/src/thrift/generate/t_js_generator.cc
index c146da7..f45ef57 100644
--- a/compiler/cpp/src/thrift/generate/t_js_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_js_generator.cc
@@ -558,7 +558,7 @@ string t_js_generator::render_const_value(t_type* type, t_const_value* value) {
} else if (type->is_enum()) {
out << value->get_integer();
} else if (type->is_struct() || type->is_xception()) {
- out << "new " << js_type_namespace(type->get_program()) << type->get_name() << "({" << endl;
+ out << "new " << js_type_namespace(type->get_program()) << type->get_name() << "({";
indent_up();
const vector<t_field*>& fields = ((t_struct*)type)->get_members();
vector<t_field*>::const_iterator f_iter;
@@ -576,12 +576,12 @@ string t_js_generator::render_const_value(t_type* type, t_const_value* value) {
}
if (v_iter != val.begin())
out << ",";
- out << render_const_value(g_type_string, v_iter->first);
+ out << endl << indent() << render_const_value(g_type_string, v_iter->first);
out << " : ";
out << render_const_value(field_type, v_iter->second);
}
-
- out << "})";
+ indent_down();
+ out << endl << indent() << "})";
} else if (type->is_map()) {
t_type* ktype = ((t_map*)type)->get_key_type();
@@ -600,9 +600,8 @@ string t_js_generator::render_const_value(t_type* type, t_const_value* value) {
out << " : ";
out << render_const_value(vtype, v_iter->second);
}
-
indent_down();
- out << endl << "}";
+ out << endl << indent() << "}";
} else if (type->is_list() || type->is_set()) {
t_type* etype;
if (type->is_list()) {