Skip to content

new constructor for function_application_exprt #4317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/solvers/smt2/smt2_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,7 @@ exprt smt2_parsert::function_application()
if(id_it->second.type.id()==ID_mathematical_function)
{
return function_application_exprt(
symbol_exprt(final_id, id_it->second.type),
op,
to_mathematical_function_type(
id_it->second.type).codomain());
symbol_exprt(final_id, id_it->second.type), op);
}
else
return symbol_exprt(final_id, id_it->second.type);
Expand Down
14 changes: 14 additions & 0 deletions src/util/mathematical_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,17 @@ Author: Daniel Kroening, [email protected]
\*******************************************************************/

#include "mathematical_expr.h"
#include "mathematical_types.h"

function_application_exprt::function_application_exprt(
const symbol_exprt &_function,
argumentst _arguments)
: binary_exprt(
_function,
ID_function_application,
multi_ary_exprt(irep_idt(), std::move(_arguments), typet()),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very odd. Can we use ID_arguments? exprt{ID_arguments, std::move(_arguments)} would IMHO look cleaner. (But that's probably not possible until #3502 is merged.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, could use ID_arguments, but could also contemplate something like ID_tuple (which is what is happening here).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Either should be a separate PR, and would need to change all constructors).

to_mathematical_function_type(_function.type()).codomain())
{
const auto &domain = to_mathematical_function_type(_function.type()).domain();
PRECONDITION(domain.size() == arguments().size());
}
5 changes: 5 additions & 0 deletions src/util/mathematical_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class function_application_exprt : public binary_exprt
public:
using argumentst = exprt::operandst;

DEPRECATED("use function_application_exprt(fkt, arg) instead")
function_application_exprt(
const symbol_exprt &_function,
const argumentst &_arguments,
Expand All @@ -201,6 +202,10 @@ class function_application_exprt : public binary_exprt
arguments() = _arguments;
}

function_application_exprt(
const symbol_exprt &_function,
argumentst _arguments);

symbol_exprt &function()
{
return static_cast<symbol_exprt &>(op0());
Expand Down