From 9cd96222dae55173d3afc17b3cf7a4701edae156 Mon Sep 17 00:00:00 2001 From: Lu Guanqun Date: Wed, 23 Dec 2015 16:12:41 +0000 Subject: [cond-expr] support conditional expression as lvalue --- libsolidity/analysis/TypeChecker.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libsolidity') diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 058e879e..416ac1ef 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -769,6 +769,14 @@ void TypeChecker::endVisit(Conditional const& _conditional) "." ); _conditional.annotation().type = commonType; + + if (_conditional.annotation().lValueRequested) + { + requireLValue(_conditional.trueExpression()); + requireLValue(_conditional.falseExpression()); + + _conditional.annotation().isLValue = true; + } } bool TypeChecker::visit(Assignment const& _assignment) -- cgit v1.2.3