aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/ReferencesResolver.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-01-28 01:27:59 +0800
committerchriseth <c@ethdev.com>2017-02-14 20:23:44 +0800
commitfc8e50f688bad9c13259fc926142b838d7aba5d3 (patch)
treee979781c794dbf111a4e1f31bef95a3e9cd30152 /libsolidity/analysis/ReferencesResolver.cpp
parentd4da4ef35f8118d49bed54f11392036e1d31f7e7 (diff)
downloaddexon-solidity-fc8e50f688bad9c13259fc926142b838d7aba5d3.tar.gz
dexon-solidity-fc8e50f688bad9c13259fc926142b838d7aba5d3.tar.zst
dexon-solidity-fc8e50f688bad9c13259fc926142b838d7aba5d3.zip
Refactor NameAndTypeResolver and SyntaxChecker to allow other entry points.
Diffstat (limited to 'libsolidity/analysis/ReferencesResolver.cpp')
-rw-r--r--libsolidity/analysis/ReferencesResolver.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp
index d589f4a0..c06181d8 100644
--- a/libsolidity/analysis/ReferencesResolver.cpp
+++ b/libsolidity/analysis/ReferencesResolver.cpp
@@ -65,6 +65,30 @@ bool ReferencesResolver::visit(ElementaryTypeName const& _typeName)
return true;
}
+bool ReferencesResolver::visit(FunctionDefinition const& _functionDefinition)
+{
+ m_returnParameters.push_back(_functionDefinition.returnParameterList().get());
+ return true;
+}
+
+void ReferencesResolver::endVisit(FunctionDefinition const&)
+{
+ solAssert(!m_returnParameters.empty(), "");
+ m_returnParameters.pop_back();
+}
+
+bool ReferencesResolver::visit(ModifierDefinition const&)
+{
+ m_returnParameters.push_back(nullptr);
+ return true;
+}
+
+void ReferencesResolver::endVisit(ModifierDefinition const&)
+{
+ solAssert(!m_returnParameters.empty(), "");
+ m_returnParameters.pop_back();
+}
+
void ReferencesResolver::endVisit(UserDefinedTypeName const& _typeName)
{
Declaration const* declaration = m_resolver.pathFromCurrentScope(_typeName.namePath());
@@ -161,7 +185,8 @@ bool ReferencesResolver::visit(InlineAssembly const& _inlineAssembly)
bool ReferencesResolver::visit(Return const& _return)
{
- _return.annotation().functionReturnParameters = m_returnParameters;
+ solAssert(!m_returnParameters.empty(), "");
+ _return.annotation().functionReturnParameters = m_returnParameters.back();
return true;
}