mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[libsolidity] TypeProvider: eliminate redundant "Type" suffix in provider function signatures.
This commit is contained in:
@@ -90,7 +90,7 @@ void CompilerUtils::revertWithStringData(Type const& _argumentType)
|
||||
m_context << Instruction::DUP2 << Instruction::MSTORE;
|
||||
m_context << u256(4) << Instruction::ADD;
|
||||
// Stack: <string data> <mem pos of encoding start>
|
||||
abiEncode({&_argumentType}, {TypeProvider::arrayType(DataLocation::Memory, true)});
|
||||
abiEncode({&_argumentType}, {TypeProvider::array(DataLocation::Memory, true)});
|
||||
toSizeAfterFreeMemoryPointer();
|
||||
m_context << Instruction::REVERT;
|
||||
}
|
||||
|
||||
@@ -872,7 +872,7 @@ bool ContractCompiler::visit(Return const& _return)
|
||||
|
||||
TypePointer expectedType;
|
||||
if (expression->annotation().type->category() == Type::Category::Tuple || types.size() != 1)
|
||||
expectedType = TypeProvider::tupleType(move(types));
|
||||
expectedType = TypeProvider::tuple(move(types));
|
||||
else
|
||||
expectedType = types.front();
|
||||
compileExpression(*expression, expectedType);
|
||||
|
||||
@@ -732,9 +732,9 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
||||
arguments.front()->accept(*this);
|
||||
// Optimization: If type is bytes or string, then do not encode,
|
||||
// but directly compute keccak256 on memory.
|
||||
if (*argType == *TypeProvider::bytesMemoryType() || *argType == *TypeProvider::stringMemoryType())
|
||||
if (*argType == *TypeProvider::bytesMemory() || *argType == *TypeProvider::stringMemory())
|
||||
{
|
||||
ArrayUtils(m_context).retrieveLength(*TypeProvider::bytesMemoryType());
|
||||
ArrayUtils(m_context).retrieveLength(*TypeProvider::bytesMemory());
|
||||
m_context << Instruction::SWAP1 << u256(0x20) << Instruction::ADD;
|
||||
}
|
||||
else
|
||||
@@ -875,8 +875,8 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
||||
TypePointer paramType = function.parameterTypes()[0];
|
||||
ArrayType const* arrayType =
|
||||
function.kind() == FunctionType::Kind::ArrayPush ?
|
||||
TypeProvider::arrayType(DataLocation::Storage, paramType) :
|
||||
TypeProvider::arrayType(DataLocation::Storage);
|
||||
TypeProvider::array(DataLocation::Storage, paramType) :
|
||||
TypeProvider::array(DataLocation::Storage);
|
||||
|
||||
// stack: ArrayReference
|
||||
arguments[0]->accept(*this);
|
||||
@@ -1062,7 +1062,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
||||
{
|
||||
FixedHash<4> hash(dev::keccak256(stringType->value()));
|
||||
m_context << (u256(FixedHash<4>::Arith(hash)) << (256 - 32));
|
||||
dataOnStack = TypeProvider::fixedBytesType(4);
|
||||
dataOnStack = TypeProvider::fixedBytes(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1073,7 +1073,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
||||
m_context << Instruction::KECCAK256;
|
||||
// stack: <memory pointer> <hash>
|
||||
|
||||
dataOnStack = TypeProvider::fixedBytesType(32);
|
||||
dataOnStack = TypeProvider::fixedBytes(32);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1115,7 +1115,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
||||
utils().abiDecode(targetTypes, false);
|
||||
else
|
||||
{
|
||||
utils().convertType(*firstArgType, *TypeProvider::bytesMemoryType());
|
||||
utils().convertType(*firstArgType, *TypeProvider::bytesMemory());
|
||||
m_context << Instruction::DUP1 << u256(32) << Instruction::ADD;
|
||||
m_context << Instruction::SWAP1 << Instruction::MLOAD;
|
||||
// stack now: <mem_pos> <length>
|
||||
@@ -1289,7 +1289,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
|
||||
identifier = FunctionType(*function).externalIdentifier();
|
||||
else
|
||||
solAssert(false, "Contract member is neither variable nor function.");
|
||||
utils().convertType(type, type.isPayable() ? *TypeProvider::payableAddressType() : *TypeProvider::addressType(), true);
|
||||
utils().convertType(type, type.isPayable() ? *TypeProvider::payableAddress() : *TypeProvider::address(), true);
|
||||
m_context << identifier;
|
||||
}
|
||||
else
|
||||
@@ -1307,7 +1307,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
|
||||
{
|
||||
utils().convertType(
|
||||
*_memberAccess.expression().annotation().type,
|
||||
*TypeProvider::addressType(),
|
||||
*TypeProvider::address(),
|
||||
true
|
||||
);
|
||||
m_context << Instruction::BALANCE;
|
||||
@@ -1324,7 +1324,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
|
||||
else if ((set<string>{"call", "callcode", "delegatecall", "staticcall"}).count(member))
|
||||
utils().convertType(
|
||||
*_memberAccess.expression().annotation().type,
|
||||
*TypeProvider::addressType(),
|
||||
*TypeProvider::address(),
|
||||
true
|
||||
);
|
||||
else
|
||||
|
||||
@@ -419,11 +419,8 @@ void StorageItem::setToZero(SourceLocation const&, bool _removeReference) const
|
||||
}
|
||||
}
|
||||
|
||||
/// Used in StorageByteArrayElement
|
||||
static FixedBytesType byteType(1);
|
||||
|
||||
StorageByteArrayElement::StorageByteArrayElement(CompilerContext& _compilerContext):
|
||||
LValue(_compilerContext, &byteType)
|
||||
LValue(_compilerContext, TypeProvider::byte())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ string YulUtilFunctions::leftAlignFunction(Type const& _type)
|
||||
templ("body", "aligned := value");
|
||||
break;
|
||||
case Type::Category::Contract:
|
||||
templ("body", "aligned := " + leftAlignFunction(*TypeProvider::addressType()) + "(value)");
|
||||
templ("body", "aligned := " + leftAlignFunction(*TypeProvider::address()) + "(value)");
|
||||
break;
|
||||
case Type::Category::Enum:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user