aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionClasses.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-04-30 21:31:16 +0800
committerchriseth <c@ethdev.com>2015-05-06 17:11:16 +0800
commita2e3bcbd0c45a79a9709dc8a69858765ab904805 (patch)
tree1201a25150145a991ef11c5f62465986c6b27dea /ExpressionClasses.cpp
parent867101e40981db56d8b72fd363e4f9e376991284 (diff)
downloaddexon-solidity-a2e3bcbd0c45a79a9709dc8a69858765ab904805.tar.gz
dexon-solidity-a2e3bcbd0c45a79a9709dc8a69858765ab904805.tar.zst
dexon-solidity-a2e3bcbd0c45a79a9709dc8a69858765ab904805.zip
Make KnownState work with all instructions.
Diffstat (limited to 'ExpressionClasses.cpp')
-rw-r--r--ExpressionClasses.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/ExpressionClasses.cpp b/ExpressionClasses.cpp
index e62f7526..cfbeba7f 100644
--- a/ExpressionClasses.cpp
+++ b/ExpressionClasses.cpp
@@ -57,12 +57,15 @@ ExpressionClasses::Id ExpressionClasses::find(
exp.arguments = _arguments;
exp.sequenceNumber = _sequenceNumber;
- if (SemanticInformation::isCommutativeOperation(_item))
- sort(exp.arguments.begin(), exp.arguments.end());
+ if (SemanticInformation::isDeterministic(_item))
+ {
+ if (SemanticInformation::isCommutativeOperation(_item))
+ sort(exp.arguments.begin(), exp.arguments.end());
- auto it = m_expressions.find(exp);
- if (it != m_expressions.end())
- return it->id;
+ auto it = m_expressions.find(exp);
+ if (it != m_expressions.end())
+ return it->id;
+ }
if (_copyItem)
exp.item = storeItem(_item);
@@ -286,7 +289,11 @@ ExpressionClasses::Id ExpressionClasses::tryToSimplify(Expression const& _expr,
{
static Rules rules;
- if (!_expr.item || _expr.item->type() != Operation)
+ if (
+ !_expr.item ||
+ _expr.item->type() != Operation ||
+ !SemanticInformation::isDeterministic(*_expr.item)
+ )
return -1;
for (auto const& rule: rules.rules())