diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2019-01-17 19:59:11 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2019-01-21 17:30:57 +0800 |
commit | 610ef9f1999c1dd201a121334394b10f6ac54bc7 (patch) | |
tree | cec0b5e39c47e82e66fd3130c9ed99df3a42b762 /libsolidity/analysis | |
parent | d3270bc31174d6c155314231e07755c4bb055729 (diff) | |
download | dexon-solidity-610ef9f1999c1dd201a121334394b10f6ac54bc7.tar.gz dexon-solidity-610ef9f1999c1dd201a121334394b10f6ac54bc7.tar.zst dexon-solidity-610ef9f1999c1dd201a121334394b10f6ac54bc7.zip |
Disallow calldata structs.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index f1a5f7ce..6d887c45 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -359,6 +359,16 @@ bool TypeChecker::visit(FunctionDefinition const& _function) }; for (ASTPointer<VariableDeclaration> const& var: _function.parameters()) { + TypePointer baseType = type(*var); + while (auto const* arrayType = dynamic_cast<ArrayType const*>(baseType.get())) + baseType = arrayType->baseType(); + + if ( + !m_scope->isInterface() && + baseType->category() == Type::Category::Struct && + baseType->dataStoredIn(DataLocation::CallData) + ) + m_errorReporter.typeError(var->location(), "Calldata structs are not yet supported."); checkArgumentAndReturnParameter(*var); var->accept(*this); } |