mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
ast, codegen: enable accessing events through contract names.
Fixes #1286
This commit is contained in:
parent
96ca706353
commit
6a312233fc
@ -1,5 +1,8 @@
|
|||||||
### 0.4.8 (unreleased)
|
### 0.4.8 (unreleased)
|
||||||
|
|
||||||
|
BugFixes:
|
||||||
|
* Type checker, code generator: enable access to events of base contracts' names.
|
||||||
|
|
||||||
### 0.4.7 (2016-12-15)
|
### 0.4.7 (2016-12-15)
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
@ -217,6 +217,9 @@ vector<Declaration const*> const& ContractDefinition::inheritableMembers() const
|
|||||||
|
|
||||||
for (EnumDefinition const* e: definedEnums())
|
for (EnumDefinition const* e: definedEnums())
|
||||||
addInheritableMember(e);
|
addInheritableMember(e);
|
||||||
|
|
||||||
|
for (EventDefinition const* e: events())
|
||||||
|
addInheritableMember(e);
|
||||||
}
|
}
|
||||||
return *m_inheritableMembers;
|
return *m_inheritableMembers;
|
||||||
}
|
}
|
||||||
|
@ -908,19 +908,43 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
|
|||||||
solAssert(_memberAccess.annotation().type, "_memberAccess has no type");
|
solAssert(_memberAccess.annotation().type, "_memberAccess has no type");
|
||||||
if (auto funType = dynamic_cast<FunctionType const*>(_memberAccess.annotation().type.get()))
|
if (auto funType = dynamic_cast<FunctionType const*>(_memberAccess.annotation().type.get()))
|
||||||
{
|
{
|
||||||
if (funType->location() != FunctionType::Location::Internal)
|
switch (funType->location())
|
||||||
{
|
|
||||||
_memberAccess.expression().accept(*this);
|
|
||||||
m_context << funType->externalIdentifier();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
case FunctionType::Location::Internal:
|
||||||
// We do not visit the expression here on purpose, because in the case of an
|
// We do not visit the expression here on purpose, because in the case of an
|
||||||
// internal library function call, this would push the library address forcing
|
// internal library function call, this would push the library address forcing
|
||||||
// us to link against it although we actually do not need it.
|
// us to link against it although we actually do not need it.
|
||||||
auto const* function = dynamic_cast<FunctionDefinition const*>(_memberAccess.annotation().referencedDeclaration);
|
if (auto const* function = dynamic_cast<FunctionDefinition const*>(_memberAccess.annotation().referencedDeclaration))
|
||||||
solAssert(!!function, "Function not found in member access");
|
utils().pushCombinedFunctionEntryLabel(*function);
|
||||||
utils().pushCombinedFunctionEntryLabel(*function);
|
else
|
||||||
|
solAssert(false, "Function not found in member access");
|
||||||
|
break;
|
||||||
|
case FunctionType::Location::Event:
|
||||||
|
if (!dynamic_cast<EventDefinition const*>(_memberAccess.annotation().referencedDeclaration))
|
||||||
|
solAssert(false, "event not found");
|
||||||
|
// no-op, because the parent node will do the job
|
||||||
|
break;
|
||||||
|
case FunctionType::Location::External:
|
||||||
|
case FunctionType::Location::Creation:
|
||||||
|
case FunctionType::Location::DelegateCall:
|
||||||
|
case FunctionType::Location::CallCode:
|
||||||
|
case FunctionType::Location::Send:
|
||||||
|
case FunctionType::Location::Bare:
|
||||||
|
case FunctionType::Location::BareCallCode:
|
||||||
|
case FunctionType::Location::BareDelegateCall:
|
||||||
|
_memberAccess.expression().accept(*this);
|
||||||
|
m_context << funType->externalIdentifier();
|
||||||
|
break;
|
||||||
|
case FunctionType::Location::Log0:
|
||||||
|
case FunctionType::Location::Log1:
|
||||||
|
case FunctionType::Location::Log2:
|
||||||
|
case FunctionType::Location::Log3:
|
||||||
|
case FunctionType::Location::Log4:
|
||||||
|
case FunctionType::Location::ECRecover:
|
||||||
|
case FunctionType::Location::SHA256:
|
||||||
|
case FunctionType::Location::RIPEMD160:
|
||||||
|
default:
|
||||||
|
solAssert(false, "unsupported member function");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dynamic_cast<TypeType const*>(_memberAccess.annotation().type.get()))
|
else if (dynamic_cast<TypeType const*>(_memberAccess.annotation().type.get()))
|
||||||
|
Loading…
Reference in New Issue
Block a user