File tree 7 files changed +16
-28
lines changed
7 files changed +16
-28
lines changed Original file line number Diff line number Diff line change @@ -202,8 +202,10 @@ void bmc_all_propertiest::report(const cover_goalst &cover_goals)
202
202
203
203
case ui_message_handlert::uit::JSON_UI:
204
204
{
205
+ if (result ().tellp () > 0 )
206
+ result () << eom; // force end of previous message
205
207
json_stream_objectt &json_result =
206
- result (). json_stream ().push_back_stream_object ();
208
+ bmc. ui_message_handler . get_json_stream ().push_back_stream_object ();
207
209
json_stream_arrayt &result_array =
208
210
json_result.push_back_stream_array (" result" );
209
211
Original file line number Diff line number Diff line change @@ -72,8 +72,10 @@ void bmct::error_trace()
72
72
73
73
case ui_message_handlert::uit::JSON_UI:
74
74
{
75
+ if (status ().tellp () > 0 )
76
+ status () << eom; // force end of previous message
75
77
json_stream_objectt &json_result =
76
- status (). json_stream ().push_back_stream_object ();
78
+ ui_message_handler. get_json_stream ().push_back_stream_object ();
77
79
const goto_trace_stept &step=goto_trace.steps .back ();
78
80
json_result[" property" ] =
79
81
json_stringt (step.pc ->source_location .get_property_id ());
Original file line number Diff line number Diff line change @@ -341,8 +341,10 @@ bool bmc_covert::operator()()
341
341
342
342
case ui_message_handlert::uit::JSON_UI:
343
343
{
344
+ if (status ().tellp () > 0 )
345
+ status () << eom; // force end of previous message
344
346
json_stream_objectt &json_result =
345
- status (). json_stream ().push_back_stream_object ();
347
+ bmc. ui_message_handler . get_json_stream ().push_back_stream_object ();
346
348
for (const auto &goal_pair : goal_map)
347
349
{
348
350
const goalt &goal=goal_pair.second ;
Original file line number Diff line number Diff line change @@ -273,7 +273,9 @@ void show_class_hierarchy(
273
273
msg.result () << messaget::eom;
274
274
break ;
275
275
case ui_message_handlert::uit::JSON_UI:
276
- hierarchy.output (msg.result ().json_stream (), children_only);
276
+ if (msg.result ().tellp () > 0 )
277
+ msg.result () << messaget::eom; // force end of previous message
278
+ hierarchy.output (message_handler.get_json_stream (), children_only);
277
279
break ;
278
280
case ui_message_handlert::uit::XML_UI:
279
281
UNIMPLEMENTED;
Original file line number Diff line number Diff line change 18
18
#include " invariant.h"
19
19
#include " json.h"
20
20
#include " source_location.h"
21
- #include " xml.h"
22
21
23
- class json_stream_arrayt ;
22
+ class xmlt ;
24
23
25
24
class message_handlert
26
25
{
@@ -36,12 +35,6 @@ class message_handlert
36
35
// no-op by default
37
36
}
38
37
39
- // / Return the underlying JSON stream
40
- virtual json_stream_arrayt &get_json_stream ()
41
- {
42
- UNREACHABLE;
43
- }
44
-
45
38
virtual void print (unsigned level, const jsont &json)
46
39
{
47
40
// no-op by default
@@ -246,14 +239,6 @@ class messaget
246
239
return func (*this );
247
240
}
248
241
249
- // / Returns a reference to the top-level JSON array stream
250
- json_stream_arrayt &json_stream ()
251
- {
252
- if (this ->tellp () > 0 )
253
- *this << eom; // force end of previous message
254
- return message.message_handler ->get_json_stream ();
255
- }
256
-
257
242
private:
258
243
void assign_from (const mstreamt &other)
259
244
{
Original file line number Diff line number Diff line change @@ -61,13 +61,8 @@ ui_message_handlert::ui_message_handlert(
61
61
62
62
case uit::JSON_UI:
63
63
{
64
- if (!json_stream)
65
- {
66
- json_stream =
67
- std::unique_ptr<json_stream_arrayt>(new json_stream_arrayt (out));
68
- }
69
-
70
- INVARIANT (json_stream, " JSON stream must be initialized before use" );
64
+ json_stream =
65
+ std::unique_ptr<json_stream_arrayt>(new json_stream_arrayt (out));
71
66
json_stream->push_back ().make_object ()[" program" ] = json_stringt (program);
72
67
}
73
68
break ;
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class ui_message_handlert : public message_handlert
41
41
42
42
virtual void flush (unsigned level) override ;
43
43
44
- json_stream_arrayt &get_json_stream () override
44
+ json_stream_arrayt &get_json_stream ()
45
45
{
46
46
PRECONDITION (json_stream!=nullptr );
47
47
return *json_stream;
You can’t perform that action at this time.
0 commit comments