From 739192ae6591c18fdb22d6ef38485378134d247d Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 15 Dec 2014 01:02:33 +0100 Subject: [PATCH] Correctly check for string prefix plus indentation change. --- ExpressionCompiler.cpp | 2 +- Types.cpp | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index add5f73be..f872e0581 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -291,7 +291,7 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) IntegerType(0, IntegerType::Modifier::ADDRESS), true); m_context << eth::Instruction::BALANCE; } - else if (member == "send" || member.substr(0, 4) == "call") + else if (member == "send" || member.substr(0, min(member.size(), 4)) == "call") appendTypeConversion(*_memberAccess.getExpression().getType(), IntegerType(0, IntegerType::Modifier::ADDRESS), true); else diff --git a/Types.cpp b/Types.cpp index a0a809b9b..c2d488418 100644 --- a/Types.cpp +++ b/Types.cpp @@ -193,14 +193,18 @@ u256 IntegerType::literalValue(Literal const& _literal) const } const MemberList IntegerType::AddressMemberList = - MemberList({{"balance", make_shared(256)}, - {"callstring32", make_shared(TypePointers({make_shared(32)}), - TypePointers(), FunctionType::Location::BARE)}, - {"callstring32string32", make_shared(TypePointers({make_shared(32), - make_shared(32)}), - TypePointers(), FunctionType::Location::BARE)}, - {"send", make_shared(TypePointers({make_shared(256)}), - TypePointers(), FunctionType::Location::SEND)}}); + MemberList({{"balance", + make_shared(256)}, + {"callstring32", + make_shared(TypePointers({make_shared(32)}), + TypePointers(), FunctionType::Location::BARE)}, + {"callstring32string32", + make_shared(TypePointers({make_shared(32), + make_shared(32)}), + TypePointers(), FunctionType::Location::BARE)}, + {"send", + make_shared(TypePointers({make_shared(256)}), + TypePointers(), FunctionType::Location::SEND)}}); shared_ptr StaticStringType::smallestTypeForLiteral(string const& _literal) {