File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,9 +139,9 @@ class StreamingJsonParser {
139139 }
140140 }
141141
142- // TODO: don 't use ::get
142+ // Don 't confuse StreamingJsonParser::get and std::unqiue_ptr ::get
143143 JsonObject* get () const {
144- return dynamic_cast <JsonObject*>( result.get () );
144+ return result.get ();
145145 }
146146
147147 // Get the result as a Python dict
@@ -150,7 +150,7 @@ class StreamingJsonParser {
150150 }
151151
152152private:
153- std::unique_ptr<JsonValue > result;
153+ std::unique_ptr<JsonObject > result;
154154 // Holds a stack of pointers to JsonObjects, make sure that pointers pushed
155155 // here have lifetimes that exceed the time on stack.
156156 std::vector<JsonObject*> stack;
@@ -164,10 +164,8 @@ class StreamingJsonParser {
164164 }
165165
166166 void processChar (char c) {
167- JsonObject* current_obj = stack.empty () ?
168- dynamic_cast <JsonObject*>(result.get ()) :
169- stack.back ();
170-
167+ JsonObject* current_obj = stack.empty () ? result.get () : stack.back ();
168+
171169 switch (state) {
172170 case START:
173171 if (c == ' {' ) {
You can’t perform that action at this time.
0 commit comments