Merge pull request #10993 from ethereum/fixModuleMemberNames

Fix module member names for importing with renaming.
This commit is contained in:
chriseth
2021-02-23 14:20:28 +01:00
committed by GitHub
4 changed files with 25 additions and 5 deletions
+6 -5
View File
@@ -112,7 +112,11 @@ util::Result<TypePointers> transformParametersToExternal(TypePointers const& _pa
}
MemberList::Member::Member(Declaration const* _declaration, Type const* _type):
name(_declaration->name()),
Member(_declaration, _type, _declaration->name())
{}
MemberList::Member::Member(Declaration const* _declaration, Type const* _type, string _name):
name(move(_name)),
type(_type),
declaration(_declaration)
{
@@ -3810,10 +3814,7 @@ MemberList::MemberMap ModuleType::nativeMembers(ASTNode const*) const
MemberList::MemberMap symbols;
for (auto const& [name, declarations]: *m_sourceUnit.annotation().exportedSymbols)
for (Declaration const* symbol: declarations)
{
solAssert(name == symbol->name(), "");
symbols.emplace_back(symbol, symbol->type());
}
symbols.emplace_back(symbol, symbol->type(), name);
return symbols;
}
+1
View File
@@ -110,6 +110,7 @@ public:
/// Constructs a Member with the name extracted from @p _declaration's name.
Member(Declaration const* _declaration, Type const* _type);
Member(Declaration const* _declaration, Type const* _type, std::string _name);
std::string name;
Type const* type = nullptr;