aboutsummaryrefslogtreecommitdiffstats
path: root/NameAndTypeResolver.cpp
diff options
context:
space:
mode:
authorGav Wood <g@ethdev.com>2015-01-27 07:01:25 +0800
committerGav Wood <g@ethdev.com>2015-01-27 07:01:25 +0800
commit8d09d8deb75a28b43a493d8afee5e743a3b201bb (patch)
treeb99e93e50d7203026cfad74e0e70ac6de654f6b1 /NameAndTypeResolver.cpp
parentfe37aad4d52f2ddd3d9fd6f6249a9a94394eaf1c (diff)
parentf59cda76def4b1d24236e5a110bfebbd688c5d1a (diff)
downloaddexon-solidity-8d09d8deb75a28b43a493d8afee5e743a3b201bb.tar.gz
dexon-solidity-8d09d8deb75a28b43a493d8afee5e743a3b201bb.tar.zst
dexon-solidity-8d09d8deb75a28b43a493d8afee5e743a3b201bb.zip
Merge pull request #856 from chriseth/sol_modifiers
Function modifiers.
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r--NameAndTypeResolver.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp
index c67cd727..43201fe1 100644
--- a/NameAndTypeResolver.cpp
+++ b/NameAndTypeResolver.cpp
@@ -60,6 +60,11 @@ void NameAndTypeResolver::resolveNamesAndTypes(ContractDefinition& _contract)
ReferencesResolver resolver(*structDef, *this, &_contract, nullptr);
for (ASTPointer<VariableDeclaration> const& variable: _contract.getStateVariables())
ReferencesResolver resolver(*variable, *this, &_contract, nullptr);
+ for (ASTPointer<ModifierDefinition> const& modifier: _contract.getFunctionModifiers())
+ {
+ m_currentScope = &m_scopes[modifier.get()];
+ ReferencesResolver resolver(*modifier, *this, &_contract, nullptr);
+ }
for (ASTPointer<FunctionDefinition> const& function: _contract.getDefinedFunctions())
{
m_currentScope = &m_scopes[function.get()];
@@ -227,6 +232,19 @@ void DeclarationRegistrationHelper::endVisit(FunctionDefinition&)
closeCurrentScope();
}
+bool DeclarationRegistrationHelper::visit(ModifierDefinition& _modifier)
+{
+ registerDeclaration(_modifier, true);
+ m_currentFunction = &_modifier;
+ return true;
+}
+
+void DeclarationRegistrationHelper::endVisit(ModifierDefinition&)
+{
+ m_currentFunction = nullptr;
+ closeCurrentScope();
+}
+
void DeclarationRegistrationHelper::endVisit(VariableDefinition& _variableDefinition)
{
// Register the local variables with the function
@@ -293,8 +311,7 @@ void ReferencesResolver::endVisit(VariableDeclaration& _variable)
bool ReferencesResolver::visit(Return& _return)
{
- solAssert(m_returnParameters, "Return parameters not set.");
- _return.setFunctionReturnParameters(*m_returnParameters);
+ _return.setFunctionReturnParameters(m_returnParameters);
return true;
}