aboutsummaryrefslogtreecommitdiffstats
path: root/NameAndTypeResolver.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-12-17 06:45:24 +0800
committerChristian <c@ethdev.com>2014-12-17 06:49:02 +0800
commit147e77b61fd202cbfd593270cc2639477ea7c61e (patch)
treee45799327589cddf7af99b92cb906da9b7c497ce /NameAndTypeResolver.cpp
parent5b802b685e794832bf8834183bf6c9604e513bbf (diff)
downloaddexon-solidity-147e77b61fd202cbfd593270cc2639477ea7c61e.tar.gz
dexon-solidity-147e77b61fd202cbfd593270cc2639477ea7c61e.tar.zst
dexon-solidity-147e77b61fd202cbfd593270cc2639477ea7c61e.zip
Fix: Resolve function types of all contracts before checking types inside functions.
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r--NameAndTypeResolver.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp
index 2ad27680..80732615 100644
--- a/NameAndTypeResolver.cpp
+++ b/NameAndTypeResolver.cpp
@@ -49,8 +49,6 @@ void NameAndTypeResolver::resolveNamesAndTypes(ContractDefinition& _contract)
m_currentScope = &m_scopes[&_contract];
for (ASTPointer<StructDefinition> const& structDef: _contract.getDefinedStructs())
ReferencesResolver resolver(*structDef, *this, nullptr);
- for (ASTPointer<StructDefinition> const& structDef: _contract.getDefinedStructs())
- structDef->checkValidityOfMembers();
for (ASTPointer<VariableDeclaration> const& variable: _contract.getStateVariables())
ReferencesResolver resolver(*variable, *this, nullptr);
for (ASTPointer<FunctionDefinition> const& function: _contract.getDefinedFunctions())
@@ -59,13 +57,16 @@ void NameAndTypeResolver::resolveNamesAndTypes(ContractDefinition& _contract)
ReferencesResolver referencesResolver(*function, *this,
function->getReturnParameterList().get());
}
- // First, the parameter types of all functions need to be resolved before we can check
- // the types, since it is possible to call functions that are only defined later
- // in the source.
- _contract.checkTypeRequirements();
m_currentScope = &m_scopes[nullptr];
}
+void NameAndTypeResolver::checkTypeRequirements(ContractDefinition& _contract)
+{
+ for (ASTPointer<StructDefinition> const& structDef: _contract.getDefinedStructs())
+ structDef->checkValidityOfMembers();
+ _contract.checkTypeRequirements();
+}
+
void NameAndTypeResolver::updateDeclaration(Declaration const& _declaration)
{
m_scopes[nullptr].registerDeclaration(_declaration, true);