Merge pull request #338 from guanqun/add_paren

support syntax "(x) = 3"
This commit is contained in:
chriseth
2016-01-05 13:15:29 +01:00
4 changed files with 26 additions and 2 deletions
+4 -1
View File
@@ -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;
}
+6 -1
View File
@@ -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;
}