Add code access dependency.

This commit is contained in:
chriseth 2019-01-15 00:14:10 +01:00
parent e6fee257e6
commit 0bfdaa500a

View File

@ -2100,9 +2100,20 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
{ {
if (magicType->kind() == MagicType::Kind::ABI) if (magicType->kind() == MagicType::Kind::ABI)
annotation.isPure = true; annotation.isPure = true;
else if (magicType->kind() == MagicType::Kind::MetaType) else if (magicType->kind() == MagicType::Kind::MetaType && (
if (memberName == "creationCode" || memberName == "runtimeCode") memberName == "creationCode" || memberName == "runtimeCode"
annotation.isPure = true; ))
{
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; return false;