File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,18 @@ interval_sparse_arrayt interval_sparse_arrayt::of_array_list(
176
176
return sparse_array;
177
177
}
178
178
179
+ optionalt<interval_sparse_arrayt>
180
+ interval_sparse_arrayt::of_expr (const exprt &expr, const exprt &extra_value)
181
+ {
182
+ if (const auto &array_expr = expr_try_dynamic_cast<array_exprt>(expr))
183
+ return interval_sparse_arrayt (*array_expr, extra_value);
184
+ if (const auto &with_expr = expr_try_dynamic_cast<with_exprt>(expr))
185
+ return interval_sparse_arrayt (*with_expr);
186
+ if (expr.id () == " array-list" )
187
+ return of_array_list (expr, extra_value);
188
+ return {};
189
+ }
190
+
179
191
void equation_symbol_mappingt::add (const std::size_t i, const exprt &expr)
180
192
{
181
193
equations_containing[expr].push_back (i);
Original file line number Diff line number Diff line change @@ -132,6 +132,11 @@ class interval_sparse_arrayt final : public sparse_arrayt
132
132
133
133
exprt to_if_expression (const exprt &index) const override ;
134
134
135
+ // / If the expression is an array_exprt or a with_exprt uses the appropriate
136
+ // / constructor, otherwise returns empty optional.
137
+ static optionalt<interval_sparse_arrayt>
138
+ of_expr (const exprt &expr, const exprt &extra_value);
139
+
135
140
private:
136
141
explicit interval_sparse_arrayt (exprt default_value)
137
142
: sparse_arrayt(default_value)
You can’t perform that action at this time.
0 commit comments