mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adding bytes.concat function type.
This commit is contained in:
parent
a27c9c39b2
commit
1493326e48
@ -2877,6 +2877,7 @@ string FunctionType::richIdentifier() const
|
|||||||
case Kind::MulMod: id += "mulmod"; break;
|
case Kind::MulMod: id += "mulmod"; break;
|
||||||
case Kind::ArrayPush: id += "arraypush"; break;
|
case Kind::ArrayPush: id += "arraypush"; break;
|
||||||
case Kind::ArrayPop: id += "arraypop"; break;
|
case Kind::ArrayPop: id += "arraypop"; break;
|
||||||
|
case Kind::BytesConcat: id += "bytesconcat"; break;
|
||||||
case Kind::ObjectCreation: id += "objectcreation"; break;
|
case Kind::ObjectCreation: id += "objectcreation"; break;
|
||||||
case Kind::Assert: id += "assert"; break;
|
case Kind::Assert: id += "assert"; break;
|
||||||
case Kind::Require: id += "require"; break;
|
case Kind::Require: id += "require"; break;
|
||||||
@ -3736,6 +3737,20 @@ MemberList::MemberMap TypeType::nativeMembers(ASTNode const* _currentScope) cons
|
|||||||
for (ASTPointer<EnumValue> const& enumValue: enumDef.members())
|
for (ASTPointer<EnumValue> const& enumValue: enumDef.members())
|
||||||
members.emplace_back(enumValue.get(), enumType);
|
members.emplace_back(enumValue.get(), enumType);
|
||||||
}
|
}
|
||||||
|
else if (
|
||||||
|
auto const* arrayType = dynamic_cast<ArrayType const*>(m_actualType);
|
||||||
|
arrayType && arrayType->isByteArray()
|
||||||
|
)
|
||||||
|
members.emplace_back("concat", TypeProvider::function(
|
||||||
|
TypePointers{},
|
||||||
|
TypePointers{TypeProvider::bytesMemory()},
|
||||||
|
strings{},
|
||||||
|
strings{string()},
|
||||||
|
FunctionType::Kind::BytesConcat,
|
||||||
|
/* _arbitraryParameters */ true,
|
||||||
|
StateMutability::Pure
|
||||||
|
));
|
||||||
|
|
||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1158,6 +1158,7 @@ public:
|
|||||||
MulMod, ///< MULMOD
|
MulMod, ///< MULMOD
|
||||||
ArrayPush, ///< .push() to a dynamically sized array in storage
|
ArrayPush, ///< .push() to a dynamically sized array in storage
|
||||||
ArrayPop, ///< .pop() from a dynamically sized array in storage
|
ArrayPop, ///< .pop() from a dynamically sized array in storage
|
||||||
|
BytesConcat, ///< .concat() on bytes (type type)
|
||||||
ObjectCreation, ///< array creation using new
|
ObjectCreation, ///< array creation using new
|
||||||
Assert, ///< assert()
|
Assert, ///< assert()
|
||||||
Require, ///< require()
|
Require, ///< require()
|
||||||
|
@ -1021,6 +1021,12 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
|||||||
ArrayUtils(m_context).popStorageArrayElement(*arrayType);
|
ArrayUtils(m_context).popStorageArrayElement(*arrayType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case FunctionType::Kind::BytesConcat:
|
||||||
|
{
|
||||||
|
_functionCall.expression().accept(*this);
|
||||||
|
solUnimplementedAssert(false, "Bytes concat not implemented in codegen yet.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
case FunctionType::Kind::ObjectCreation:
|
case FunctionType::Kind::ObjectCreation:
|
||||||
{
|
{
|
||||||
ArrayType const& arrayType = dynamic_cast<ArrayType const&>(*_functionCall.annotation().type);
|
ArrayType const& arrayType = dynamic_cast<ArrayType const&>(*_functionCall.annotation().type);
|
||||||
|
@ -1323,6 +1323,11 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case FunctionType::Kind::BytesConcat:
|
||||||
|
{
|
||||||
|
solUnimplementedAssert(false, "bytes.concat not yet implemented in codegen.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
case FunctionType::Kind::MetaType:
|
case FunctionType::Kind::MetaType:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user