diff options
author | chriseth <c@ethdev.com> | 2016-01-05 20:15:29 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-01-05 20:15:29 +0800 |
commit | b158e48c1a8be7258f283be049c1db779e661998 (patch) | |
tree | dda06998f7c742c42e5ed73977812d0578336e35 /libsolidity | |
parent | 252bd142b9c84dc86956f646ae8a4559e7620279 (diff) | |
parent | 208429644dbf646e90107447b148e7edb6c36512 (diff) | |
download | dexon-solidity-b158e48c1a8be7258f283be049c1db779e661998.tar.gz dexon-solidity-b158e48c1a8be7258f283be049c1db779e661998.tar.zst dexon-solidity-b158e48c1a8be7258f283be049c1db779e661998.zip |
Merge pull request #338 from guanqun/add_paren
support syntax "(x) = 3"
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 5 | ||||
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 9718bf75..de30dcf7 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -792,7 +792,10 @@ bool TypeChecker::visit(TupleExpression const& _tuple) } else types.push_back(TypePointer()); - _tuple.annotation().type = make_shared<TupleType>(types); + if (components.size() == 1) + _tuple.annotation().type = type(*components[0]); + else + _tuple.annotation().type = make_shared<TupleType>(types); // If some of the components are not LValues, the error is reported above. _tuple.annotation().isLValue = true; } diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 2fd0b2c4..b0e92b59 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -233,7 +233,12 @@ bool ExpressionCompiler::visit(TupleExpression const& _tuple) else if (_tuple.annotation().lValueRequested) lvalues.push_back(unique_ptr<LValue>()); if (_tuple.annotation().lValueRequested) - m_currentLValue.reset(new TupleObject(m_context, move(lvalues))); + { + if (_tuple.components().size() == 1) + m_currentLValue = move(lvalues[0]); + else + m_currentLValue.reset(new TupleObject(m_context, move(lvalues))); + } return false; } |