Bare callcode for addresses and contracts.

This commit is contained in:
chriseth
2015-05-15 18:02:09 +02:00
parent 33e7086058
commit dba5ffc280
4 changed files with 75 additions and 28 deletions
+21 -2
View File
@@ -316,6 +316,7 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe
const MemberList IntegerType::AddressMemberList({
{"balance", make_shared<IntegerType >(256)},
{"call", make_shared<FunctionType>(strings(), strings(), FunctionType::Location::Bare, true)},
{"callcode", make_shared<FunctionType>(strings(), strings(), FunctionType::Location::BareCallCode, true)},
{"send", make_shared<FunctionType>(strings{"uint"}, strings{}, FunctionType::Location::Send)}
});
@@ -1115,9 +1116,11 @@ unsigned FunctionType::getSizeOnStack() const
}
unsigned size = 0;
if (location == Location::External)
if (location == Location::External || location == Location::CallCode)
size = 2;
else if (location == Location::Internal || location == Location::Bare)
else if (location == Location::Bare || location == Location::BareCallCode)
size = 1;
else if (location == Location::Internal)
size = 1;
if (m_gasSet)
size++;
@@ -1156,6 +1159,7 @@ MemberList const& FunctionType::getMembers() const
case Location::SHA256:
case Location::RIPEMD160:
case Location::Bare:
case Location::BareCallCode:
if (!m_members)
{
MemberList::MemberMap members{
@@ -1228,6 +1232,21 @@ bool FunctionType::hasEqualArgumentTypes(FunctionType const& _other) const
);
}
bool FunctionType::isBareCall() const
{
switch (m_location)
{
case Location::Bare:
case Location::BareCallCode:
case Location::ECRecover:
case Location::SHA256:
case Location::RIPEMD160:
return true;
default:
return false;
}
}
string FunctionType::externalSignature(std::string const& _name) const
{
std::string funcName = _name;