aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-04-11 23:27:06 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-04-12 00:30:34 +0800
commitcb548f6f530cf52d8490fb194623888126bd85d4 (patch)
tree6ca950c91d2dba0f44a24ed59b775e5588e8a537 /libsolidity/analysis
parentfdcbf1337a018087fe82a2fbef938d0acd6769f9 (diff)
downloaddexon-solidity-cb548f6f530cf52d8490fb194623888126bd85d4.tar.gz
dexon-solidity-cb548f6f530cf52d8490fb194623888126bd85d4.tar.zst
dexon-solidity-cb548f6f530cf52d8490fb194623888126bd85d4.zip
Fix ConstantEvaluator to correctly handle single element tuples.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/ConstantEvaluator.cpp6
-rw-r--r--libsolidity/analysis/ConstantEvaluator.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/libsolidity/analysis/ConstantEvaluator.cpp b/libsolidity/analysis/ConstantEvaluator.cpp
index 83f37f47..8659bbfd 100644
--- a/libsolidity/analysis/ConstantEvaluator.cpp
+++ b/libsolidity/analysis/ConstantEvaluator.cpp
@@ -87,6 +87,12 @@ void ConstantEvaluator::endVisit(Identifier const& _identifier)
setType(_identifier, type(*value));
}
+void ConstantEvaluator::endVisit(TupleExpression const& _tuple)
+{
+ if (!_tuple.isInlineArray() && _tuple.components().size() == 1)
+ setType(_tuple, type(*_tuple.components().front()));
+}
+
void ConstantEvaluator::setType(ASTNode const& _node, TypePointer const& _type)
{
if (_type && _type->category() == Type::Category::RationalNumber)
diff --git a/libsolidity/analysis/ConstantEvaluator.h b/libsolidity/analysis/ConstantEvaluator.h
index 77a357b6..ac3a24a1 100644
--- a/libsolidity/analysis/ConstantEvaluator.h
+++ b/libsolidity/analysis/ConstantEvaluator.h
@@ -56,6 +56,7 @@ private:
virtual void endVisit(UnaryOperation const& _operation);
virtual void endVisit(Literal const& _literal);
virtual void endVisit(Identifier const& _identifier);
+ virtual void endVisit(TupleExpression const& _tuple);
void setType(ASTNode const& _node, TypePointer const& _type);
TypePointer type(ASTNode const& _node);