mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Do not use the member in checkRepresentation
This commit is contained in:
parent
c1e14d0119
commit
0e91b8fb98
@ -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())
|
||||||
{
|
{
|
||||||
|
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user