aboutsummaryrefslogtreecommitdiffstats
path: root/Scope.h
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-10-14 00:22:15 +0800
committerChristian <c@ethdev.com>2014-10-16 00:40:19 +0800
commit89b794f1dc15c8688526470b9d68b361dab82be3 (patch)
tree92db8a29965ee2dd796b22a1508f58b2d199e71e /Scope.h
parentbdac5c7b4b5c23ea4f2cfe4a779da05b4722f1be (diff)
downloaddexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar
dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar.gz
dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar.bz2
dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar.lz
dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar.xz
dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.tar.zst
dexon-solidity-89b794f1dc15c8688526470b9d68b361dab82be3.zip
Type system, not yet complete.
Diffstat (limited to 'Scope.h')
-rw-r--r--Scope.h24
1 files changed, 6 insertions, 18 deletions
diff --git a/Scope.h b/Scope.h
index be2514c4..e3b024ec 100644
--- a/Scope.h
+++ b/Scope.h
@@ -24,6 +24,8 @@
#include <map>
+#include <boost/noncopyable.hpp>
+
#include <libsolidity/ASTForward.h>
namespace dev {
@@ -33,29 +35,15 @@ class Scope
{
public:
explicit Scope(Scope* _outerScope = nullptr) : m_outerScope(_outerScope) {}
- /// Registers the name _name in the scope unless it is already declared. Returns true iff
+ /// Registers the declaration in the scope unless its name is already declared. Returns true iff
/// it was not yet declared.
- bool registerName(ASTString const& _name, ASTNode& _declaration)
- {
- if (m_declaredNames.find(_name) != m_declaredNames.end())
- return false;
- m_declaredNames[_name] = &_declaration;
- return true;
- }
- ASTNode* resolveName(ASTString const& _name, bool _recursive = false) const
- {
- auto result = m_declaredNames.find(_name);
- if (result != m_declaredNames.end())
- return result->second;
- if (_recursive && m_outerScope != nullptr)
- return m_outerScope->resolveName(_name, true);
- return nullptr;
- }
+ bool registerDeclaration(Declaration& _declaration);
+ Declaration* resolveName(ASTString const& _name, bool _recursive = false) const;
Scope* getOuterScope() const { return m_outerScope; }
private:
Scope* m_outerScope;
- std::map<ASTString, ASTNode*> m_declaredNames;
+ std::map<ASTString, Declaration*> m_declarations;
};
} }