Merge lp:~marcustomlinson/unity-js-scopes/lp-1543059 into lp:unity-js-scopes

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Alexandre Abreu
Approved revision: 128
Merged at revision: 128
Proposed branch: lp:~marcustomlinson/unity-js-scopes/lp-1543059
Merge into: lp:unity-js-scopes
Diff against target: 45 lines (+22/-11)
1 file modified
src/bindings/src/preview-widget.cc (+22/-11)
To merge this branch: bzr merge lp:~marcustomlinson/unity-js-scopes/lp-1543059
Reviewer Review Type Date Requested Status
Alexandre Abreu (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+285679@code.launchpad.net

Commit message

Deal with non-dict types for variant arrays in PreviewWidget::add_attribute_value()

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandre Abreu (abreu-alexandre) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/bindings/src/preview-widget.cc'
--- src/bindings/src/preview-widget.cc 2016-02-04 10:12:41 +0000
+++ src/bindings/src/preview-widget.cc 2016-02-11 05:19:56 +0000
@@ -89,19 +89,30 @@
89 if (v.which() == unity::scopes::Variant::Array) {89 if (v.which() == unity::scopes::Variant::Array) {
90 unity::scopes::VariantArray va = v.get_array();90 unity::scopes::VariantArray va = v.get_array();
9191
92 for (auto &d : va) {92 if (va.empty())
93 if (d.which() == unity::scopes::Variant::Dict) {93 {
94 unity::scopes::VariantMap vm = d.get_dict();94 return;
95 std::vector<std::pair<std::string, unity::scopes::Variant>> t;95 }
9696 else if (va.front().which() == unity::scopes::Variant::Dict)
97 for (auto &c : vm) {97 {
98 t.push_back({c.first, c.second});98 for (auto &d : va) {
99 if (d.which() == unity::scopes::Variant::Dict) {
100 unity::scopes::VariantMap vm = d.get_dict();
101 std::vector<std::pair<std::string, unity::scopes::Variant>> t;
102
103 for (auto &c : vm) {
104 t.push_back({c.first, c.second});
105 }
106
107 vb.add_tuple(t);
99 }108 }
100
101 vb.add_tuple(t);
102 }109 }
103 }110 preview_widget_->add_attribute_value(key, vb.end());
104 preview_widget_->add_attribute_value(key, vb.end());111 }
112 else
113 {
114 preview_widget_->add_attribute_value(key, v);
115 }
105 }116 }
106 else if (v.which() == unity::scopes::Variant::Dict) {117 else if (v.which() == unity::scopes::Variant::Dict) {
107 unity::scopes::VariantMap vm = v.get_dict();118 unity::scopes::VariantMap vm = v.get_dict();

Subscribers

People subscribed via source and target branches

to all changes: