Remove useless constructors (aggregate initialization is enough for those)

By the way, turn those classes into structs since all their members are public.
master
Sébastien Villemot 2022-07-20 13:22:21 +02:00
parent 83a94aca57
commit f0629555a5
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
8 changed files with 14 additions and 71 deletions

View File

@ -140,13 +140,9 @@ public:
expr_t MinusOne, MinusInfinity;
//! Raised when a local parameter is declared twice
class LocalVariableException
struct LocalVariableException
{
public:
string name;
explicit LocalVariableException(string name_arg) : name{move(name_arg)}
{
}
};
class DivisionByZeroException
@ -291,13 +287,9 @@ public:
};
//! Raised when a trend is declared twice
class TrendException
struct TrendException
{
public:
string name;
explicit TrendException(string name_arg) : name{move(name_arg)}
{
}
};
// Returns the derivation ID, or throws an exception if the derivation ID does not exist
@ -341,14 +333,10 @@ public:
return false;
};
class UnknownLocalVariableException
struct UnknownLocalVariableException
{
public:
//! Symbol ID
int id;
explicit UnknownLocalVariableException(int id_arg) : id(id_arg)
{
}
};
expr_t

View File

@ -551,13 +551,9 @@ public:
void analyzePacEquationStructure(const string &name, map<string, string> &pac_eq_name, PacModelTable::equation_info_t &pac_equation_info);
// Exception thrown by getPacTargetSymbId()
class PacTargetNotIdentifiedException
struct PacTargetNotIdentifiedException
{
public:
const string model_name, message;
PacTargetNotIdentifiedException(string model_name_arg, string message_arg) : model_name{move(model_name_arg)}, message{move(message_arg)}
{
}
};
//! Return target of the pac equation

View File

@ -31,14 +31,9 @@ class EquationTags
private:
map<int, map<string, string>> eqn_tags;
public:
class TagNotFoundException
struct TagNotFoundException
{
public:
const string key, value;
explicit TagNotFoundException(string key_arg, string value_arg)
: key{move(key_arg)}, value{move(value_arg)}
{
}
};
// Add multiple equation tags for the given equation

View File

@ -763,13 +763,9 @@ public:
virtual pair<int, expr_t> matchEndogenousTimesConstant() const;
//! Exception thrown when matching fails
class MatchFailureException
struct MatchFailureException
{
public:
const string message;
MatchFailureException(string message_arg) : message{move(message_arg)}
{
};
};
/* Match an expression of the form ∏ x(l)ᵏ, where x are endogenous, as used

View File

@ -33,14 +33,10 @@ class ExternalFunctionsTable
{
public:
//! Thrown when trying to access an unknown symbol (by id)
class UnknownExternalFunctionSymbolIDException
struct UnknownExternalFunctionSymbolIDException
{
public:
//! Symbol ID
int id;
explicit UnknownExternalFunctionSymbolIDException(int id_arg) : id{id_arg}
{
}
};
/* For all arguments, -2 means not set

View File

@ -41,13 +41,9 @@ public:
// This constructor is deliberately not marked explicit, to allow implicit conversion
SymbolList(vector<string> symbols_arg);
class SymbolListException
struct SymbolListException
{
public:
const string message;
SymbolListException(string message_arg) : message{move(message_arg)}
{
};
};
//! Remove duplicate symbols
void removeDuplicates(const string &dynare_command, WarningConsolidation &warnings);

View File

@ -188,56 +188,36 @@ private:
public:
//! Thrown when trying to access an unknown symbol (by name)
class UnknownSymbolNameException
struct UnknownSymbolNameException
{
public:
//! Symbol name
const string name;
explicit UnknownSymbolNameException(string name_arg) : name{move(name_arg)}
{
}
};
//! Thrown when trying to access an unknown symbol (by id)
class UnknownSymbolIDException
struct UnknownSymbolIDException
{
public:
//! Symbol ID
const int id;
explicit UnknownSymbolIDException(int id_arg) : id{id_arg}
{
}
};
//! Thrown when trying to access an unknown type specific ID
class UnknownTypeSpecificIDException
struct UnknownTypeSpecificIDException
{
public:
const int tsid;
const SymbolType type;
UnknownTypeSpecificIDException(int tsid_arg, SymbolType type_arg) : tsid{tsid_arg}, type{type_arg}
{
}
};
/* Thrown when requesting the type specific ID of a symbol which doesnt
have one */
class NoTypeSpecificIDException
struct NoTypeSpecificIDException
{
public:
const int symb_id;
explicit NoTypeSpecificIDException(int symb_id_arg) : symb_id{symb_id_arg}
{
}
};
//! Thrown when trying to declare a symbol twice
class AlreadyDeclaredException
struct AlreadyDeclaredException
{
public:
//! Symbol name
const string name;
//! Was the previous declaration done with the same symbol type ?
const bool same_type;
AlreadyDeclaredException(string name_arg, bool same_type_arg) : name{move(name_arg)}, same_type{same_type_arg}
{
}
};
//! Thrown when table is frozen and trying to modify it
class FrozenException

View File

@ -69,13 +69,9 @@ namespace macro
Driver &operator=(const Driver &) = delete;
//! Exception thrown when value of an unknown variable is requested
class UnknownVariable
struct UnknownVariable
{
public:
const string name;
explicit UnknownVariable(string name_arg) : name{move(name_arg)}
{
}
};
//! Starts parsing a file, modifies `env`, `paths` and `output`