diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-10-22 02:02:31 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-10-24 22:34:23 +0800 |
commit | acba7b92e5456d14bda1db8b3c71909d6d49c53f (patch) | |
tree | 6b2bc85c88b5b02d45d3fcaf4e28e8cb35ca1cf0 /libsolidity/codegen/ExpressionCompiler.cpp | |
parent | 47b11ef2b800f7eacbdf7329184b549ee33569ab (diff) | |
download | dexon-solidity-acba7b92e5456d14bda1db8b3c71909d6d49c53f.tar.gz dexon-solidity-acba7b92e5456d14bda1db8b3c71909d6d49c53f.tar.zst dexon-solidity-acba7b92e5456d14bda1db8b3c71909d6d49c53f.zip |
codegen: if a member access has been resolved as a variable, follow that
This fixes at least the first example in #988
Diffstat (limited to 'libsolidity/codegen/ExpressionCompiler.cpp')
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index da3e56cc..1cb74c06 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -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); } |