Do not use the member in checkRepresentation

This commit is contained in:
Alex Beregszaszi 2017-04-27 11:29:26 +01:00
parent c1e14d0119
commit 0e91b8fb98
2 changed files with 4 additions and 4 deletions

View File

@ -232,11 +232,11 @@ AssemblyItems ComputeMethod::findRepresentation(u256 const& _value)
} }
} }
bool ComputeMethod::checkRepresentation(u256 const& _value) bool ComputeMethod::checkRepresentation(u256 const& _value, AssemblyItems const& _routine)
{ {
// This is a tiny EVM that can only evaluate some instructions. // This is a tiny EVM that can only evaluate some instructions.
vector<u256> stack; vector<u256> stack;
for (AssemblyItem const& item: m_routine) for (AssemblyItem const& item: _routine)
{ {
switch (item.type()) switch (item.type())
{ {

View File

@ -135,7 +135,7 @@ public:
{ {
m_routine = findRepresentation(m_value); m_routine = findRepresentation(m_value);
assertThrow( assertThrow(
checkRepresentation(m_value), checkRepresentation(m_value, m_routine),
OptimizerException, OptimizerException,
"Invalid constant expression created." "Invalid constant expression created."
); );
@ -151,7 +151,7 @@ protected:
/// Tries to recursively find a way to compute @a _value. /// Tries to recursively find a way to compute @a _value.
AssemblyItems findRepresentation(u256 const& _value); AssemblyItems findRepresentation(u256 const& _value);
/// Recomputes the value from the calculated representation and checks for correctness. /// Recomputes the value from the calculated representation and checks for correctness.
bool checkRepresentation(u256 const& _value); bool checkRepresentation(u256 const& _value, AssemblyItems const& _routine);
bigint gasNeeded(AssemblyItems const& _routine); bigint gasNeeded(AssemblyItems const& _routine);
/// Counter for the complexity of optimization, will stop when it reaches zero. /// Counter for the complexity of optimization, will stop when it reaches zero.