mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	length member for byte arrays.
This commit is contained in:
		
							parent
							
								
									5e40b79426
								
							
						
					
					
						commit
						b836d952b2
					
				| @ -504,6 +504,12 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) | ||||
| 		} | ||||
| 		BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid member access to " + type.toString())); | ||||
| 	} | ||||
| 	case Type::Category::ByteArray: | ||||
| 	{ | ||||
| 		solAssert(member == "length", "Illegal bytearray member."); | ||||
| 		m_context << eth::Instruction::SLOAD; | ||||
| 		break; | ||||
| 	} | ||||
| 	default: | ||||
| 		BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Member access to unknown type.")); | ||||
| 	} | ||||
|  | ||||
| @ -541,6 +541,8 @@ unsigned ByteArrayType::getSizeOnStack() const | ||||
| 		return 1; | ||||
| } | ||||
| 
 | ||||
| const MemberList ByteArrayType::s_byteArrayMemberList = MemberList({{"length", make_shared<IntegerType >(256)}}); | ||||
| 
 | ||||
| bool ContractType::operator==(Type const& _other) const | ||||
| { | ||||
| 	if (_other.getCategory() != getCategory()) | ||||
|  | ||||
							
								
								
									
										2
									
								
								Types.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Types.h
									
									
									
									
									
								
							| @ -292,11 +292,13 @@ public: | ||||
| 	virtual bool operator==(const Type& _other) const override; | ||||
| 	virtual unsigned getSizeOnStack() const override; | ||||
| 	virtual std::string toString() const override { return "bytes"; } | ||||
| 	virtual MemberList const& getMembers() const override { return s_byteArrayMemberList; } | ||||
| 
 | ||||
| 	Location getLocation() const { return m_location; } | ||||
| 
 | ||||
| private: | ||||
| 	Location m_location; | ||||
| 	static const MemberList s_byteArrayMemberList; | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user