aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-11-20 01:02:04 +0800
committerchriseth <c@ethdev.com>2015-11-26 22:37:55 +0800
commit86495dfc57dde9b825ffd8c219ea809446e978f9 (patch)
tree99003d3865a0fbb9c08bd20c6b290f0702f31821 /libsolidity/codegen
parentc498dcce22b2921ee57f280da9117e491c021e1b (diff)
downloaddexon-solidity-86495dfc57dde9b825ffd8c219ea809446e978f9.tar
dexon-solidity-86495dfc57dde9b825ffd8c219ea809446e978f9.tar.gz
dexon-solidity-86495dfc57dde9b825ffd8c219ea809446e978f9.tar.bz2
dexon-solidity-86495dfc57dde9b825ffd8c219ea809446e978f9.tar.lz
dexon-solidity-86495dfc57dde9b825ffd8c219ea809446e978f9.tar.xz
dexon-solidity-86495dfc57dde9b825ffd8c219ea809446e978f9.tar.zst
dexon-solidity-86495dfc57dde9b825ffd8c219ea809446e978f9.zip
Make members context-sensitive.
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r--libsolidity/codegen/CompilerUtils.cpp4
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp8
-rw-r--r--libsolidity/codegen/LValue.cpp4
3 files changed, 6 insertions, 10 deletions
diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp
index 357013e6..b57f5b29 100644
--- a/libsolidity/codegen/CompilerUtils.cpp
+++ b/libsolidity/codegen/CompilerUtils.cpp
@@ -542,7 +542,7 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp
allocateMemory();
m_context << eth::Instruction::SWAP1 << eth::Instruction::DUP2;
// stack: <memory ptr> <source ref> <memory ptr>
- for (auto const& member: typeOnStack.members())
+ for (auto const& member: typeOnStack.members(nullptr))
{
if (!member.type->canLiveOutsideStorage())
continue;
@@ -642,7 +642,7 @@ void CompilerUtils::pushZeroValue(Type const& _type)
m_context << eth::Instruction::DUP1;
if (auto structType = dynamic_cast<StructType const*>(&_type))
- for (auto const& member: structType->members())
+ for (auto const& member: structType->members(nullptr))
{
pushZeroValue(*member.type);
storeInMemoryDynamic(*member.type);
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index c94c988b..6c288ae7 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -888,10 +888,6 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess)
case Type::Category::TypeType:
{
TypeType const& type = dynamic_cast<TypeType const&>(*_memberAccess.expression().annotation().type);
- solAssert(
- !type.members().membersByName(_memberAccess.memberName()).empty(),
- "Invalid member access to " + type.toString(false)
- );
if (dynamic_cast<ContractType const*>(type.actualType().get()))
{
@@ -1043,11 +1039,11 @@ void ExpressionCompiler::endVisit(Identifier const& _identifier)
Declaration const* declaration = _identifier.annotation().referencedDeclaration;
if (MagicVariableDeclaration const* magicVar = dynamic_cast<MagicVariableDeclaration const*>(declaration))
{
- switch (magicVar->type(_identifier.annotation().contractScope)->category())
+ switch (magicVar->type()->category())
{
case Type::Category::Contract:
// "this" or "super"
- if (!dynamic_cast<ContractType const&>(*magicVar->type(_identifier.annotation().contractScope)).isSuper())
+ if (!dynamic_cast<ContractType const&>(*magicVar->type()).isSuper())
m_context << eth::Instruction::ADDRESS;
break;
case Type::Category::Integer:
diff --git a/libsolidity/codegen/LValue.cpp b/libsolidity/codegen/LValue.cpp
index 864f28d0..fdef6937 100644
--- a/libsolidity/codegen/LValue.cpp
+++ b/libsolidity/codegen/LValue.cpp
@@ -273,7 +273,7 @@ void StorageItem::storeValue(Type const& _sourceType, SourceLocation const& _loc
"Struct assignment with conversion."
);
solAssert(sourceType.location() != DataLocation::CallData, "Structs in calldata not supported.");
- for (auto const& member: structType.members())
+ for (auto const& member: structType.members(nullptr))
{
// assign each member that is not a mapping
TypePointer const& memberType = member.type;
@@ -336,7 +336,7 @@ void StorageItem::setToZero(SourceLocation const&, bool _removeReference) const
// @todo this can be improved: use StorageItem for non-value types, and just store 0 in
// all slots that contain value types later.
auto const& structType = dynamic_cast<StructType const&>(*m_dataType);
- for (auto const& member: structType.members())
+ for (auto const& member: structType.members(nullptr))
{
// zero each member that is not a mapping
TypePointer const& memberType = member.type;