File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,8 +45,7 @@ class JsonString : public JsonValue {
4545 bool isString () const override { return true ; }
4646 bool isObject () const override { return false ; }
4747
48- std::string& getValue () { return value; }
49- const std::string& getValue () const { return value; }
48+ void append (char c) { value += c; }
5049
5150 py::object toPython () const override {
5251 return py::str (value);
@@ -199,9 +198,9 @@ class StreamingJsonParser {
199198 state = EXPECT_COMMA_OR_END;
200199 } else {
201200 auto * value = current_obj->get (current_key);
202- if (value && value->isString ()) {
203- dynamic_cast <JsonString*>(value)-> getValue () += c;
204- }
201+ assert (value != nullptr && value->isString () && " current_obj not inited in IN_VALUE " );
202+ // since value is a JsonValue*, must cast to JsonString*
203+ dynamic_cast <JsonString*>(value)-> append (c);
205204 }
206205 break ;
207206
You can’t perform that action at this time.
0 commit comments