diff options
author | Federico Bond <federicobond@gmail.com> | 2017-06-15 23:36:14 +0800 |
---|---|---|
committer | Federico Bond <federicobond@gmail.com> | 2017-06-22 09:46:27 +0800 |
commit | 0f8ad1d68f60270fb22057e787ff689318c31fa9 (patch) | |
tree | 5b6f9f78fdce1e7164c4ebf94011d1598664f1c5 /libsolidity/analysis | |
parent | 26ea9ce07cf85849cd881465a4322f14bff87eb8 (diff) | |
download | dexon-solidity-0f8ad1d68f60270fb22057e787ff689318c31fa9.tar.gz dexon-solidity-0f8ad1d68f60270fb22057e787ff689318c31fa9.tar.zst dexon-solidity-0f8ad1d68f60270fb22057e787ff689318c31fa9.zip |
Fix segmentation fault with constant function parameters
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 2a8d1ff6..4194e1c2 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -463,6 +463,8 @@ 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 type is not allowed for public or external functions."); + + var->accept(*this); } for (ASTPointer<ModifierInvocation> const& modifier: _function.modifiers()) visitManually( @@ -487,7 +489,12 @@ bool TypeChecker::visit(FunctionDefinition const& _function) bool TypeChecker::visit(VariableDeclaration const& _variable) { - if (m_scope->contractKind() == ContractDefinition::ContractKind::Interface) + // Forbid any variable declarations inside interfaces unless they are part of + // a function's input/output parameters. + if ( + m_scope->contractKind() == ContractDefinition::ContractKind::Interface + && !_variable.isCallableParameter() + ) m_errorReporter.typeError(_variable.location(), "Variables cannot be declared in interfaces."); // Variables can be declared without type (with "var"), in which case the first assignment |