@@ -132,24 +132,33 @@ bool coverage_goalst::get_coverage_goals(
132
132
return true ;
133
133
}
134
134
135
- for (const auto &goal : json.array )
135
+ // traverse the given JSON file
136
+ for (const auto &goals_in_json : json.array )
136
137
{
137
- // get the file of each existing goal
138
- irep_idt file=goal[" file" ].value ;
139
- source_location.set_file (file);
140
-
141
- // get the function of each existing goal
142
- irep_idt function=goal[" function" ].value ;
143
- source_location.set_function (function);
144
-
145
- // get the lines array
146
- if (goal[" lines" ].is_array ())
138
+ // get the set of goals
139
+ if (goals_in_json[" goals" ].is_array ())
147
140
{
148
- for (const auto &line_json : goal[" lines" ].array )
141
+ // store the source location for each existing goal
142
+ for (const auto &each_goal : goals_in_json[" goals" ].array )
149
143
{
150
- // get the line of each existing goal
151
- irep_idt line=line_json[" number" ].value ;
144
+ // get and set the bytecode_index
145
+ irep_idt bytecode_index=
146
+ each_goal[" sourceLocation" ][" bytecode_index" ].value ;
147
+ source_location.set_java_bytecode_index (bytecode_index);
148
+
149
+ // get and set the file
150
+ irep_idt file=each_goal[" sourceLocation" ][" file" ].value ;
151
+ source_location.set_file (file);
152
+
153
+ // get and set the function
154
+ irep_idt function=each_goal[" sourceLocation" ][" function" ].value ;
155
+ source_location.set_function (function);
156
+
157
+ // get and set the line
158
+ irep_idt line=each_goal[" sourceLocation" ][" line" ].value ;
152
159
source_location.set_line (line);
160
+
161
+ // store the existing goal
153
162
goals.add_goal (source_location);
154
163
}
155
164
}
0 commit comments