aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/miscellaneous.rst12
-rw-r--r--libsolidity/ast/AST.cpp2
-rw-r--r--libsolidity/ast/Types.cpp11
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp10
4 files changed, 25 insertions, 10 deletions
diff --git a/docs/miscellaneous.rst b/docs/miscellaneous.rst
index e8631224..87041be6 100644
--- a/docs/miscellaneous.rst
+++ b/docs/miscellaneous.rst
@@ -87,10 +87,14 @@ Solidity always places new objects at the free memory pointer and memory is neve
Layout of Call Data
*******************
-When a Solidity contract is deployed and when it is called from an
-account, the input data is assumed to be in the format in :ref:`the ABI
-specification <ABI>`. The ABI specification requires arguments to be padded to multiples of 32
-bytes. The internal function calls use a different convention.
+The input data for a function call is assumed to be in the format defined by the :ref:`ABI
+specification <ABI>`. Among others, the ABI specification requires arguments to be padded to multiples of 32
+bytes. The internal function calls use a different convention.
+
+Arguments for the constructor of a contract are directly appended at the end of the
+contract's code, also in ABI encoding. The constructor will access them through a hard-coded offset, and
+not by using the ``codesize`` opcode, since this of course changes when appending
+data to the code.
.. index: variable cleanup
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp
index a376e55d..635ab024 100644
--- a/libsolidity/ast/AST.cpp
+++ b/libsolidity/ast/AST.cpp
@@ -397,7 +397,7 @@ SourceUnit const& Scopable::sourceUnit() const
{
ASTNode const* s = scope();
solAssert(s, "");
- // will not always be a declaratoion
+ // will not always be a declaration
while (dynamic_cast<Scopable const*>(s) && dynamic_cast<Scopable const*>(s)->scope())
s = dynamic_cast<Scopable const*>(s)->scope();
return dynamic_cast<SourceUnit const&>(*s);
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index ccf31543..b1cd15b4 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -2929,6 +2929,17 @@ string FunctionType::externalSignature() const
{
solAssert(m_declaration != nullptr, "External signature of function needs declaration");
solAssert(!m_declaration->name().empty(), "Fallback function has no signature.");
+ switch (kind())
+ {
+ case Kind::Internal:
+ case Kind::External:
+ case Kind::CallCode:
+ case Kind::DelegateCall:
+ case Kind::Event:
+ break;
+ default:
+ solAssert(false, "Invalid function type for requesting external signature.");
+ }
bool const inLibrary = dynamic_cast<ContractDefinition const&>(*m_declaration->scope()).isLibrary();
FunctionTypePointer external = interfaceFunctionType();
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index 9baad7d1..53a06090 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -1165,19 +1165,19 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
solAssert(false, "event not found");
// no-op, because the parent node will do the job
break;
- case FunctionType::Kind::External:
- case FunctionType::Kind::Creation:
case FunctionType::Kind::DelegateCall:
+ _memberAccess.expression().accept(*this);
+ m_context << funType->externalIdentifier();
+ break;
case FunctionType::Kind::CallCode:
+ case FunctionType::Kind::External:
+ case FunctionType::Kind::Creation:
case FunctionType::Kind::Send:
case FunctionType::Kind::BareCall:
case FunctionType::Kind::BareCallCode:
case FunctionType::Kind::BareDelegateCall:
case FunctionType::Kind::BareStaticCall:
case FunctionType::Kind::Transfer:
- _memberAccess.expression().accept(*this);
- m_context << funType->externalIdentifier();
- break;
case FunctionType::Kind::Log0:
case FunctionType::Kind::Log1:
case FunctionType::Kind::Log2: