diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-12-02 09:01:55 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-12-11 10:34:42 +0800 |
commit | e9d256ddf4322050f9b834abd3400f1cb5377f68 (patch) | |
tree | 6d4fca6a46240f2d2ac44a138163f63ae88050cd /libsolidity/analysis | |
parent | 226bfe5be1f7443e644d2cfd62aac19b56836b8a (diff) | |
download | dexon-solidity-e9d256ddf4322050f9b834abd3400f1cb5377f68.tar.gz dexon-solidity-e9d256ddf4322050f9b834abd3400f1cb5377f68.tar.zst dexon-solidity-e9d256ddf4322050f9b834abd3400f1cb5377f68.zip |
Suggest the experimental ABI encoder if using structs as function parameters
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 96160a75..daa5471a 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -570,6 +570,16 @@ bool TypeChecker::visit(FunctionDefinition const& _function) m_errorReporter.typeError(var->location(), "Type is required to live outside storage."); if (_function.visibility() >= FunctionDefinition::Visibility::Public && !(type(*var)->interfaceType(isLibraryFunction))) m_errorReporter.fatalTypeError(var->location(), "Internal or recursive type is not allowed for public or external functions."); + if ( + _function.visibility() > FunctionDefinition::Visibility::Internal && + type(*var)->category() == Type::Category::Struct && + !_function.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::ABIEncoderV2) + ) + m_errorReporter.typeError( + var->location(), + "Structs are only supported in the new experimental ABI encoder. " + "Use \"pragma experimental ABIEncoderV2;\" to enable the feature." + ); var->accept(*this); } |