codegen: if a member access has been resolved as a variable, follow that

This fixes at least the first example in #988
This commit is contained in:
Yoichi Hirai
2016-10-24 16:34:23 +02:00
parent 47b11ef2b8
commit acba7b92e5
@@ -888,6 +888,18 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
{
// no-op
}
else if (auto variable = dynamic_cast<VariableDeclaration const*>(_memberAccess.annotation().referencedDeclaration))
{
// TODO duplicate code should be unified
if (!variable->isConstant())
setLValueFromDeclaration(*_memberAccess.annotation().referencedDeclaration, _memberAccess);
else
{
variable->value()->accept(*this);
utils().convertType(*variable->value()->annotation().type, *variable->annotation().type);
}
}
else
_memberAccess.expression().accept(*this);
}