Merge pull request #20856 from KoBeWi/pretty-dictionary-print

Add some curly braces to make dictionary printing less ambiguous
This commit is contained in:
Rémi Verschelde 2018-08-14 20:51:42 +02:00 committed by GitHub
commit 66da2ca320
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1460,7 +1460,7 @@ Variant::operator String() const {
const Dictionary &d = *reinterpret_cast<const Dictionary *>(_data._mem); const Dictionary &d = *reinterpret_cast<const Dictionary *>(_data._mem);
//const String *K=NULL; //const String *K=NULL;
String str; String str("{");
List<Variant> keys; List<Variant> keys;
d.get_key_list(&keys); d.get_key_list(&keys);
@ -1479,8 +1479,9 @@ Variant::operator String() const {
for (int i = 0; i < pairs.size(); i++) { for (int i = 0; i < pairs.size(); i++) {
if (i > 0) if (i > 0)
str += ", "; str += ", ";
str += "(" + pairs[i].key + ":" + pairs[i].value + ")"; str += pairs[i].key + ":" + pairs[i].value;
} }
str += "}";
return str; return str;
} break; } break;