aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-23 00:46:15 +0800
committerGitHub <noreply@github.com>2017-06-23 00:46:15 +0800
commitbffb8c404f0df22c4da7cdc2a8affcbb77377582 (patch)
tree04d461c2159cfd73c9898f3072f85b46be97b969 /libsolidity
parentce069e9c1e510ce8a1073e3d6ef0814300c5af41 (diff)
parent0f8ad1d68f60270fb22057e787ff689318c31fa9 (diff)
downloaddexon-solidity-bffb8c404f0df22c4da7cdc2a8affcbb77377582.tar
dexon-solidity-bffb8c404f0df22c4da7cdc2a8affcbb77377582.tar.gz
dexon-solidity-bffb8c404f0df22c4da7cdc2a8affcbb77377582.tar.bz2
dexon-solidity-bffb8c404f0df22c4da7cdc2a8affcbb77377582.tar.lz
dexon-solidity-bffb8c404f0df22c4da7cdc2a8affcbb77377582.tar.xz
dexon-solidity-bffb8c404f0df22c4da7cdc2a8affcbb77377582.tar.zst
dexon-solidity-bffb8c404f0df22c4da7cdc2a8affcbb77377582.zip
Merge pull request #2408 from federicobond/constant-parameters
Fix segmentation fault with constant function parameters
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp9
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