mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	We only care about member types.
This commit is contained in:
		
							parent
							
								
									93c98a6e52
								
							
						
					
					
						commit
						735dbe6986
					
				
							
								
								
									
										2
									
								
								AST.cpp
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								AST.cpp
									
									
									
									
									
								
							@ -469,7 +469,7 @@ void MemberAccess::checkTypeRequirements()
 | 
				
			|||||||
	unsigned memberIndex = type.memberNameToIndex(*m_memberName);
 | 
						unsigned memberIndex = type.memberNameToIndex(*m_memberName);
 | 
				
			||||||
	if (memberIndex >= type.getMemberCount())
 | 
						if (memberIndex >= type.getMemberCount())
 | 
				
			||||||
		BOOST_THROW_EXCEPTION(createTypeError("Member \"" + *m_memberName + "\" not found in " + type.toString()));
 | 
							BOOST_THROW_EXCEPTION(createTypeError("Member \"" + *m_memberName + "\" not found in " + type.toString()));
 | 
				
			||||||
	m_type = type.getMemberByIndex(memberIndex).getType();
 | 
						m_type = type.getMemberByIndex(memberIndex);
 | 
				
			||||||
	m_isLvalue = true;
 | 
						m_isLvalue = true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -234,7 +234,7 @@ u256 StructType::getStorageSize() const
 | 
				
			|||||||
bool StructType::canLiveOutsideStorage() const
 | 
					bool StructType::canLiveOutsideStorage() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	for (unsigned i = 0; i < getMemberCount(); ++i)
 | 
						for (unsigned i = 0; i < getMemberCount(); ++i)
 | 
				
			||||||
		if (!getMemberByIndex(i).getType()->canLiveOutsideStorage())
 | 
							if (!getMemberByIndex(i)->canLiveOutsideStorage())
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -258,9 +258,9 @@ unsigned StructType::memberNameToIndex(string const& _name) const
 | 
				
			|||||||
	return unsigned(-1);
 | 
						return unsigned(-1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VariableDeclaration const& StructType::getMemberByIndex(unsigned _index) const
 | 
					shared_ptr<Type const> const& StructType::getMemberByIndex(unsigned _index) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return *m_struct.getMembers()[_index];
 | 
						return m_struct.getMembers()[_index].getType();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
u256 StructType::getStorageOffsetOfMember(unsigned _index) const
 | 
					u256 StructType::getStorageOffsetOfMember(unsigned _index) const
 | 
				
			||||||
@ -269,7 +269,7 @@ u256 StructType::getStorageOffsetOfMember(unsigned _index) const
 | 
				
			|||||||
	u256 offset;
 | 
						u256 offset;
 | 
				
			||||||
//	vector<ASTPointer<VariableDeclaration>> const& members = m_struct.getMembers();
 | 
					//	vector<ASTPointer<VariableDeclaration>> const& members = m_struct.getMembers();
 | 
				
			||||||
	for (unsigned index = 0; index < _index; ++index)
 | 
						for (unsigned index = 0; index < _index; ++index)
 | 
				
			||||||
		offset += getMemberByIndex(index).getType()->getStorageSize();
 | 
							offset += getMemberByIndex(index)->getStorageSize();
 | 
				
			||||||
	return offset;
 | 
						return offset;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								Types.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Types.h
									
									
									
									
									
								
							@ -190,7 +190,7 @@ public:
 | 
				
			|||||||
	unsigned getMemberCount() const;
 | 
						unsigned getMemberCount() const;
 | 
				
			||||||
	/// Returns the index of the member with name @a _name or unsigned(-1) if it does not exist.
 | 
						/// Returns the index of the member with name @a _name or unsigned(-1) if it does not exist.
 | 
				
			||||||
	unsigned memberNameToIndex(std::string const& _name) const;
 | 
						unsigned memberNameToIndex(std::string const& _name) const;
 | 
				
			||||||
	VariableDeclaration const& getMemberByIndex(unsigned _index) const;
 | 
						std::shared_ptr<Type const> const& getMemberByIndex(unsigned _index) const;
 | 
				
			||||||
	u256 getStorageOffsetOfMember(unsigned _index) const;
 | 
						u256 getStorageOffsetOfMember(unsigned _index) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user