diff options
author | Christian <c@ethdev.com> | 2014-10-13 21:07:21 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-10-13 23:02:21 +0800 |
commit | 4f791179640fdcfbbd62c4c7a2a5273081b7b742 (patch) | |
tree | 7c7576b991884befde24473b5f6370b8afa83b2f /NameAndTypeResolver.h | |
parent | 98bdd7429974521946a1aa3bffa038fc515f745c (diff) | |
download | dexon-solidity-4f791179640fdcfbbd62c4c7a2a5273081b7b742.tar.gz dexon-solidity-4f791179640fdcfbbd62c4c7a2a5273081b7b742.tar.zst dexon-solidity-4f791179640fdcfbbd62c4c7a2a5273081b7b742.zip |
Name resolution.
Diffstat (limited to 'NameAndTypeResolver.h')
-rw-r--r-- | NameAndTypeResolver.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/NameAndTypeResolver.h b/NameAndTypeResolver.h new file mode 100644 index 00000000..ca714ac2 --- /dev/null +++ b/NameAndTypeResolver.h @@ -0,0 +1,40 @@ +#pragma once + +#include <map> + +#include <libsolidity/Scope.h> +#include <libsolidity/ASTVisitor.h> + +namespace dev { +namespace solidity { + +class NameAndTypeResolver +{ +public: + NameAndTypeResolver(); + + void resolveNamesAndTypes(ContractDefinition& _contract); +private: + class ScopeHelper; //< RIIA helper to open and close scopes + + void reset(); + + void handleContract(ContractDefinition& _contract); + void handleFunction(FunctionDefinition& _function); + void handleFunctionBody(Block& _functionBody); + void registerVariablesInFunction(Block& _functionBody); + void resolveReferencesInFunction(Block& _functionBody); + + void registerName(ASTString const& _name, ASTNode& _declaration); + ASTNode* getNameFromCurrentScope(ASTString const& _name, bool _recursive = true); + + void enterNewSubScope(ASTNode& _node); + void closeCurrentScope(); + + Scope m_globalScope; // not part of the map + std::map<ASTNode*, Scope> m_scopes; + + Scope* m_currentScope; +}; + +} } |