diff options
author | chriseth <chris@ethereum.org> | 2019-01-15 07:14:10 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2019-01-18 03:36:48 +0800 |
commit | 0bfdaa500af6ae1a480f6f6f417a6a12ada0a313 (patch) | |
tree | 309a529d0c9d785d4062d77822ab3df1548224d3 | |
parent | e6fee257e68e7b145a47eee8c5937db7a7a99849 (diff) | |
download | dexon-solidity-0bfdaa500af6ae1a480f6f6f417a6a12ada0a313.tar.gz dexon-solidity-0bfdaa500af6ae1a480f6f6f417a6a12ada0a313.tar.zst dexon-solidity-0bfdaa500af6ae1a480f6f6f417a6a12ada0a313.zip |
Add code access dependency.
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 4cdfcc0c..ee5865f7 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -2100,9 +2100,20 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) { if (magicType->kind() == MagicType::Kind::ABI) annotation.isPure = true; - else if (magicType->kind() == MagicType::Kind::MetaType) - if (memberName == "creationCode" || memberName == "runtimeCode") - annotation.isPure = true; + else if (magicType->kind() == MagicType::Kind::MetaType && ( + memberName == "creationCode" || memberName == "runtimeCode" + )) + { + annotation.isPure = true; + m_scope->annotation().contractDependencies.insert( + &dynamic_cast<ContractType const&>(*magicType->typeArgument()).contractDefinition() + ); + if (contractDependenciesAreCyclic(*m_scope)) + m_errorReporter.typeError( + _memberAccess.location(), + "Circular reference for contract code access." + ); + } } return false; |