Browse Source

Small fixes in Types and ExpressionCompiler

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
490cb5608e
  1. 4
      libsolidity/ExpressionCompiler.cpp
  2. 3
      libsolidity/Types.cpp
  3. 2
      libsolidity/Types.h

4
libsolidity/ExpressionCompiler.cpp

@ -860,8 +860,8 @@ unsigned ExpressionCompiler::appendArgumentsCopyToMemory(vector<ASTPointer<Expre
unsigned ExpressionCompiler::moveTypeToMemory(Type const& _type, Location const& _location, unsigned _memoryOffset, bool _padToWordBoundaries) unsigned ExpressionCompiler::moveTypeToMemory(Type const& _type, Location const& _location, unsigned _memoryOffset, bool _padToWordBoundaries)
{ {
unsigned const encodedSize = _type.getCalldataEncodedSize(); unsigned const c_encodedSize = _type.getCalldataEncodedSize();
unsigned const c_numBytes = _padToWordBoundaries ? CompilerUtils::getPaddedSize(encodedSize) : encodedSize; unsigned const c_numBytes = _padToWordBoundaries ? CompilerUtils::getPaddedSize(c_encodedSize) : c_encodedSize;
if (c_numBytes == 0 || c_numBytes > 32) if (c_numBytes == 0 || c_numBytes > 32)
BOOST_THROW_EXCEPTION(CompilerError() BOOST_THROW_EXCEPTION(CompilerError()
<< errinfo_sourceLocation(_location) << errinfo_sourceLocation(_location)

3
libsolidity/Types.cpp

@ -364,8 +364,7 @@ u256 IntegerConstantType::literalValue(Literal const* _literal) const
TypePointer IntegerConstantType::getRealType() const TypePointer IntegerConstantType::getRealType() const
{ {
auto intType = getIntegerType(); auto intType = getIntegerType();
if (!intType) solAssert(!!intType, std::string("getRealType called with invalid integer constant") + toString());
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("getRealType called with invalid integer constant" + toString()));
return intType; return intType;
} }

2
libsolidity/Types.h

@ -131,7 +131,7 @@ public:
virtual bool isValueType() const { return false; } virtual bool isValueType() const { return false; }
virtual unsigned getSizeOnStack() const { return 1; } virtual unsigned getSizeOnStack() const { return 1; }
/// @returns the real type of some types, like e.g: IntegerConstant /// @returns the real type of some types, like e.g: IntegerConstant
virtual TypePointer getRealType() const { return TypePointer(); } virtual TypePointer getRealType() const { return shared_from_this(); }
/// Returns the list of all members of this type. Default implementation: no members. /// Returns the list of all members of this type. Default implementation: no members.
virtual MemberList const& getMembers() const { return EmptyMemberList; } virtual MemberList const& getMembers() const { return EmptyMemberList; }

Loading…
Cancel
Save